0

I have a xsl-fo file defined as below ,

<?xml version="1.0" encoding="utf-8" ?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="master">
      <fo:region-body margin-bottom="0.5in" margin-top="0.9in" margin-left="35pt"/>
      <fo:region-before region-name="xsl-region-before" extent="0.9in"/>
      <fo:region-after region-name="xsl-region-after" extent="0.5in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="master">
    
    <fo:static-content flow-name="xsl-region-before">
    Some not needed things will be here
    </fo:static-content>

    <fo:static-content flow-name="xsl-region-after">
    
    Some not needed things will be here
    
    </fo:static-content>

    <fo:flow flow-name="xsl-region-body">
      <fo:block font-size="10pt" xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:table table-layout="fixed" space-after="0pt" border-collapse="separate" border-separation="0pt">
// This is the content that I need
  </fo:table>
</fo:block>
      <fo:block id="end"/>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Is there any way I can remove some regions that are defined in this fo that I do not need for processing ? What I am trying to do is remove the <fo:static-content flow-name="xsl-region-after"> and <fo:static-content flow-name="xsl-region-before"> competely from this . How can I do that . Would really appreciate some help

  • check out this : https://stackoverflow.com/questions/13731374/how-to-remove-an-element-from-an-xml-using-xdocument-when-we-have-multiple-eleme – Mohammed Sajid Jul 07 '20 at 07:47

1 Answers1

0

Assuming that you have an XSLT processor available, you can use a stylesheet that is an identity template plus a higher-priority template that drops the elements that you don't want:

<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="2.0"
    xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="fo:static-content" />
 
<!-- Identity template. -->
<xsl:template match="@* | node()" mode="#all">
  <xsl:copy>
    <xsl:apply-templates select="@* | node()" mode="#current"/>
  </xsl:copy>
</xsl:template>

</xsl:stylesheet>
Tony Graham
  • 7,306
  • 13
  • 20