我正在做一个 xsl 转换,我想将几个不同的文档放在同一个 pdf 中。我有第一页、最后一页和其他页面的简单页面母版。我需要找到一种方法来使用最后一页然后是第一页并重置页码来开始一个新文档。
<fo:layout-master-set>
<fo:simple-page-master master-name="first-page">
<fo:region-body margin-bottom="1in" region-name="main-body"/>
<fo:region-after extent="1in" region-name="page-footer" display-align="after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="other-pages">
<fo:region-body margin-top=".5in" margin-bottom=".5in" region-name="main-body"/>
<fo:region-before extent=".5in" region-name="page-header" display-align="before"/>
<fo:region-after extent=".5in" region-name="page-footer" display-align="after"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="last-page">
<fo:region-body margin-top=".5in" margin-bottom="1in" region-name="main-body"/>
<fo:region-before extent=".5in" region-name="page-header" display-align="before"/>
<fo:region-after extent="1in" region-name="page-footer" display-align="after"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="my-sequence">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first"
master-reference="first-page"/>
<fo:conditional-page-master-reference page-position="last"
master-reference="last-page"/>
<fo:conditional-page-master-reference odd-or-even="rest"
master-reference="other-pages"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
我尝试设置初始页码,但它不允许我在页面内进行。有任何想法吗?
这是页面序列。
<fo:page-sequence master-reference="my-sequence">
<fo:static-content flow-name="page-header" font-style="italic">
<xsl:if test="/Report[string-length(@print-page-headers) = 0 or @print-page-headers != 'false']">
<fo:block>
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row line-height="12pt" font-size="10pt">
<fo:table-cell>
<fo:block text-align="left">
<xsl:value-of select="/Report/ReportInfo/title "/>
</fo:block>
</fo:table-cell>
<fo:table-cell line-height="12pt" font-size="10pt">
<fo:block text-align="right">
Page <fo:page-number/> of <fo:page-number-citation ref-id="terminator"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block>
<fo:leader leader-pattern="rule" rule-thickness="1pt" leader-length="100%"/>
</fo:block>
</xsl:if>
</fo:static-content>
<fo:static-content flow-name="page-footer">
<xsl:if test="/Report[string-length(@print-page-footers) = 0 or @print-page-footers != 'false']">
<fo:block >
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-body>
<fo:table-row height="9in">
<fo:table-cell display-align="after">
<fo:retrieve-marker retrieve-class-name="includes"/>
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row>
<fo:table-cell text-align="left">
<fo:block font-family="serif" font-size="8pt">
<xsl:value-of select="/Report/reportName"/>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="center">
<fo:block font-family="serif" font-size="6pt">
<xsl:text></xsl:text>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="right">
<fo:block font-family="serif" font-size="8pt">
<xsl:value-of select="/Report/ReportInfo/date"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell number-columns-spanned="3" text-align="center">
<fo:block font-family="serif" font-size="6pt">
<xsl:text></xsl:text>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
</xsl:if>
</fo:static-content>
<fo:flow flow-name="main-body">
<fo:block hyphenate="true" language="en">
<xsl:apply-templates/>
</fo:block>
<fo:block id="terminator"/>
</fo:flow>
</fo:page-sequence>
我尝试使用模板重置初始页码:
<xsl:template match="newreport">
<fo:page-sequence initial-page-number="1" master-reference="my-sequence">
<fo:static-content flow-name="page-header" font-style="italic">
<fo:block break-before="page"/>
<fo:block>
<fo:table width="100%" table-layout="fixed">
<fo:table-column/>
<fo:table-column/>
<fo:table-body>
<fo:table-row line-height="12pt" font-size="10pt">
<fo:table-cell>
<fo:block text-align="left">
<xsl:value-of select="/Report/ReportInfo/title "/>
</fo:block>
</fo:table-cell>
<fo:table-cell line-height="12pt" font-size="10pt">
<fo:block text-align="right">
Page <fo:page-number/> of <fo:page-number-citation ref-id="terminator"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block>
<fo:block>
<fo:leader leader-pattern="rule" rule-thickness="1pt" leader-length="100%"/>
</fo:block>
</fo:static-content>
</fo:page-sequence>
</xsl:template>
这行不通。我从第一页序列中复制了代码。我希望能够重置到第一页并执行页眉等。