6
我想在每个页面中创建一个包含页眉和页脚的PDF文档,我不知道他们为什么只出现在奇数页中。页眉和页脚XSL FO
我简化了代码,我创建了一个表格,并重复了几次以获得4页但结果相同,页眉和页脚仅出现在第一页和第三页。
这是代码。 xsl版本是1.0。
<xsl:output indent="yes"/>
<xsl:template match ="template">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<!-- layout information -->
<fo:simple-page-master master-name="pagetemplate"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="0.1cm"
margin-left="0.8cm"
margin-right="1.0cm">
<fo:region-body margin-top="2.5cm" margin-bottom="2.5cm"/>
<fo:region-before extent="2.0cm"/>
<fo:region-after extent="2.0cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="pagetemplate">
<fo:static-content flow-name="xsl-region-before">
<fo:block>
<xsl:call-template name="header"/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block>
<xsl:call-template name="footer"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="block"/>
<xsl:call-template name="block"/>
<xsl:call-template name="block"/>
<xsl:call-template name="block"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>