Apache fop、XSL FO:偶尔会在页面序列的流程末尾添加空页面(不是最后一个)
Apache fop, XSL FO: Occasionally adds empty page at the end of flow in page sequence (not the last one)
使用 apache-fop 1.0 也尝试了具有相同行为的 2.1。
我的问题:
- 为什么会产生空白页?
- 页码怎样才能像
第 4 页(共 3 页)很奇怪?
- 如何省略空白页,同时保留
页码?
场景:
使用以下 XSL fop 偶尔会在页面流的末尾插入一个空的 页面。这也会导致 奇怪的页码编号,例如第 4 页,共 3 页 。
共有 3 个不同的页面序列,每个序列的页码编号应从 1 开始。第一个页面应仅添加封面之类的内容。第二个页面序列应该在第一页、最后一页和其他页面上使用不同的页脚呈现一些 table 数据。第三个页面序列应该代表类似于第二个页面序列的副本,具有相同的输出但实际上具有略微不同的页眉 and/or 页脚。
但是,在每个序列的末尾插入一个空白页 - 除了最后一个页面序列。
每个页面序列本身(其他已注释掉)工作正常,没有生成空页面。
我的 XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0"
xsi:schemaLocation="http://www.w3.org/1999/XSL/Format http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/src/foschema/fop.xsd?view=co">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-cover"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-first"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body" space-before="11cm" space-after="3cm"/>
<fo:region-before region-name="header-first" extent="11cm"/>
<fo:region-after region-name="footer-first" extent="3cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-other"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body" space-before="3cm" space-after="5cm"/>
<fo:region-before region-name="header-other" extent="3cm"/>
<fo:region-after region-name="footer-other" extent="5cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-last"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body" space-before="3cm" space-after="5cm"/>
<fo:region-before region-name="header-last" extent="3cm"/>
<fo:region-after region-name="footer-last" extent="5cm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="A4-multi">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="A4-first"/>
<fo:conditional-page-master-reference page-position="rest" master-reference="A4-other"/>
<fo:conditional-page-master-reference page-position="last" master-reference="A4-last"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="A4-very-first">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="A4-cover"/>
<fo:conditional-page-master-reference page-position="rest" master-reference="A4-other"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-very-first" initial-page-number="1">
<fo:flow flow-name="body">
<fo:block>just the first page</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="A4-multi" initial-page-number="1">
<xsl:call-template name="header-first"/>
<xsl:call-template name="header-other"/>
<xsl:call-template name="header-last"/>
<xsl:call-template name="footer-first"/>
<xsl:call-template name="footer-other"/>
<xsl:call-template name="footer-last"/>
<xsl:call-template name="flow-1"/>
</fo:page-sequence>
<fo:page-sequence master-reference="A4-multi" initial-page-number="1">
<xsl:call-template name="header-first"/>
<xsl:call-template name="header-other"/>
<xsl:call-template name="header-last"/>
<xsl:call-template name="footer-first"/>
<xsl:call-template name="footer-other"/>
<xsl:call-template name="footer-last"/>
<xsl:call-template name="flow-2"/>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template name="flow-1">
<fo:flow flow-name="body">
<xsl:call-template name="item-table"/>
<fo:block id="last-page-flow-1"></fo:block>
</fo:flow>
</xsl:template>
<!-- just a copy of flow 1-->
<xsl:template name="flow-2">
<fo:flow flow-name="body">
<xsl:call-template name="item-table"/>
<fo:block id="last-page-flow-2"></fo:block>
</fo:flow>
</xsl:template>
<!-- table -->
<xsl:template name="item-table">
<fo:table width="100%" border="1px solid black" table-layout="fixed">
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-header>
<fo:table-row border="1px solid red">
<fo:table-cell>
<fo:block>Item: header</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-footer>
<fo:table-row>
<fo:table-cell border="1px solid blue">
<fo:block>Item: footer</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-footer>
<fo:table-body>
<xsl:apply-templates select="list"/>
</fo:table-body>
</fo:table>
</xsl:template>
<!-- row -->
<xsl:template match="item">
<fo:table-row>
<fo:table-cell border-bottom="1px dashed black">
<fo:block>
<xsl:value-of select="out"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
<!-- the different headers -->
<xsl:template name="header-initial">
<fo:static-content flow-name="header-initial">
<fo:table background-color="yellow" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="4cm">
<fo:block>Header first page</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="header-first">
<fo:static-content flow-name="header-first">
<fo:table background-color="yellow" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="11cm">
<fo:block>Header first page</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="header-other">
<fo:static-content flow-name="header-other">
<fo:table background-color="red" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="3cm">
<fo:block>Header other pages</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="header-last">
<fo:static-content flow-name="header-last">
<fo:table background-color="blue" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="3cm">
<fo:block>Header last page</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<!-- the different footers -->
<xsl:template name="footer-initial">
<fo:static-content flow-name="footer-initial">
<fo:table background-color="orange" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="106mm">
<fo:block>Footer initial page - ESR</fo:block>
<fo:block>P<fo:page-number/>/
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="footer-first">
<fo:static-content flow-name="footer-first">
<fo:table background-color="yellow" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="3cm">
<fo:block>Footer first page</fo:block>
<fo:block>Page
<fo:page-number/>
of
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
Pages
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="footer-other">
<fo:static-content flow-name="footer-other">
<fo:table background-color="red" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="5cm">
<fo:block>Footer other pages</fo:block>
<fo:block>Page
<fo:page-number/>
of
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
Pages
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="footer-last">
<fo:static-content flow-name="footer-last">
<fo:table background-color="blue" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="5cm">
<fo:block>Footer last page</fo:block>
<fo:block>Page<fo:page-number/>of
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
Pages
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
</xsl:stylesheet>
我的 XML 有一些简单的数据
<list>
<item>
<out>Test1</out>
</item>
<item>
<out>Test2</out>
</item>
<item>
<out>Test3</out>
</item>
<item>
<out>Test4</out>
</item>
<item>
<out>Test5</out>
</item>
<item>
<out>Test6</out>
</item>
<item>
<out>Test7</out>
</item>
<item>
<out>Test8</out>
</item>
<item>
<out>Test9</out>
</item>
<item>
<out>Test10</out>
</item>
<item>
<out>Test11</out>
</item>
<item>
<out>Test12</out>
</item>
<item>
<out>Test13</out>
</item>
<item>
<out>Test14</out>
</item>
<item>
<out>Test15</out>
</item>
<item>
<out>Test16</out>
</item>
<item>
<out>Test17</out>
</item>
<item>
<out>Test18</out>
</item>
<item>
<out>Test19</out>
</item>
<item>
<out>Test20</out>
</item>
<item>
<out>Test21</out>
</item>
<item>
<out>Test22</out>
</item>
<item>
<out>Test23 -- last on page-first</out>
</item>
<!-- max items on first page -->
<item>
<out>Test24 -- first on page-other/page-last</out>
</item>
<item>
<out>Test25</out>
</item>
<item>
<out>Test26</out>
</item>
<item>
<out>Test27</out>
</item>
<item>
<out>Test28</out>
</item>
<item>
<out>Test29</out>
</item>
<item>
<out>Test30</out>
</item>
<item>
<out>Test31</out>
</item>
<item>
<out>Test32</out>
</item>
<item>
<out>Test33</out>
</item>
<item>
<out>Test34</out>
</item>
<item>
<out>Test35</out>
</item>
<item>
<out>Test36</out>
</item>
<item>
<out>Test37</out>
</item>
<item>
<out>Test38</out>
</item>
<item>
<out>Test39</out>
</item>
<item>
<out>Test40</out>
</item>
<item>
<out>Test41</out>
</item>
<item>
<out>Test42</out>
</item>
<item>
<out>Test43</out>
</item>
<item>
<out>Test44</out>
</item>
<item>
<out>Test45</out>
</item>
<item>
<out>Test46</out>
</item>
<item>
<out>Test47</out>
</item>
<item>
<out>Test48</out>
</item>
<item>
<out>Test49</out>
</item>
<item>
<out>Test50</out>
</item>
<item>
<out>Test51</out>
</item>
<item>
<out>Test52</out>
</item>
<item>
<out>Test53</out>
</item>
<item>
<out>Test54</out>
</item>
<item>
<out>Test55</out>
</item>
<item>
<out>Test56</out>
</item>
<item>
<out>Test57 - last on page-other</out>
</item>
<item>
<out>Test58 -first on page-last</out>
</item>
第二页(蓝色)最后一页之后的空白页(红色),
知道了。如果 "auto" 则页面序列的强制页数将 "Force it to be an even-page if the initial-page-number of the next page-sequence is odd" w3c
因此,由于您的第三页序列的初始页码为 1(奇数),但第二页的最后一页实际上是 5(如果我们省略第一页,则为 3)(也是奇数),所以一个页面将被添加,显然甚至没有将其视为最后(不好)。它将显示第 4 页 (因为它是第 4 页),共 3 页 (因为引用的 ID 在第 3 页).
绕过它的方法是添加一个
force-page-count="no-force"
属性到 fo:page-sequence
s
编辑
如果您还有 blank-or-not-blank="blank"
没有页眉或页脚的条件页面主参考,则添加的页面上不会显示页码。但我知道你宁愿根本没有它。
使用 apache-fop 1.0 也尝试了具有相同行为的 2.1。
我的问题:
- 为什么会产生空白页?
- 页码怎样才能像 第 4 页(共 3 页)很奇怪?
- 如何省略空白页,同时保留 页码?
场景:
使用以下 XSL fop 偶尔会在页面流的末尾插入一个空的 页面。这也会导致 奇怪的页码编号,例如第 4 页,共 3 页 。
共有 3 个不同的页面序列,每个序列的页码编号应从 1 开始。第一个页面应仅添加封面之类的内容。第二个页面序列应该在第一页、最后一页和其他页面上使用不同的页脚呈现一些 table 数据。第三个页面序列应该代表类似于第二个页面序列的副本,具有相同的输出但实际上具有略微不同的页眉 and/or 页脚。
但是,在每个序列的末尾插入一个空白页 - 除了最后一个页面序列。
每个页面序列本身(其他已注释掉)工作正常,没有生成空页面。
我的 XSL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0"
xsi:schemaLocation="http://www.w3.org/1999/XSL/Format http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/fop/src/foschema/fop.xsd?view=co">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-cover"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-first"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body" space-before="11cm" space-after="3cm"/>
<fo:region-before region-name="header-first" extent="11cm"/>
<fo:region-after region-name="footer-first" extent="3cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-other"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body" space-before="3cm" space-after="5cm"/>
<fo:region-before region-name="header-other" extent="3cm"/>
<fo:region-after region-name="footer-other" extent="5cm"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="A4-last"
page-width="210mm" page-height="297mm" margin="1cm">
<fo:region-body region-name="body" space-before="3cm" space-after="5cm"/>
<fo:region-before region-name="header-last" extent="3cm"/>
<fo:region-after region-name="footer-last" extent="5cm"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="A4-multi">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="A4-first"/>
<fo:conditional-page-master-reference page-position="rest" master-reference="A4-other"/>
<fo:conditional-page-master-reference page-position="last" master-reference="A4-last"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="A4-very-first">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="A4-cover"/>
<fo:conditional-page-master-reference page-position="rest" master-reference="A4-other"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-very-first" initial-page-number="1">
<fo:flow flow-name="body">
<fo:block>just the first page</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="A4-multi" initial-page-number="1">
<xsl:call-template name="header-first"/>
<xsl:call-template name="header-other"/>
<xsl:call-template name="header-last"/>
<xsl:call-template name="footer-first"/>
<xsl:call-template name="footer-other"/>
<xsl:call-template name="footer-last"/>
<xsl:call-template name="flow-1"/>
</fo:page-sequence>
<fo:page-sequence master-reference="A4-multi" initial-page-number="1">
<xsl:call-template name="header-first"/>
<xsl:call-template name="header-other"/>
<xsl:call-template name="header-last"/>
<xsl:call-template name="footer-first"/>
<xsl:call-template name="footer-other"/>
<xsl:call-template name="footer-last"/>
<xsl:call-template name="flow-2"/>
</fo:page-sequence>
</fo:root>
</xsl:template>
<xsl:template name="flow-1">
<fo:flow flow-name="body">
<xsl:call-template name="item-table"/>
<fo:block id="last-page-flow-1"></fo:block>
</fo:flow>
</xsl:template>
<!-- just a copy of flow 1-->
<xsl:template name="flow-2">
<fo:flow flow-name="body">
<xsl:call-template name="item-table"/>
<fo:block id="last-page-flow-2"></fo:block>
</fo:flow>
</xsl:template>
<!-- table -->
<xsl:template name="item-table">
<fo:table width="100%" border="1px solid black" table-layout="fixed">
<fo:table-column column-width="proportional-column-width(1)"/>
<fo:table-header>
<fo:table-row border="1px solid red">
<fo:table-cell>
<fo:block>Item: header</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-footer>
<fo:table-row>
<fo:table-cell border="1px solid blue">
<fo:block>Item: footer</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-footer>
<fo:table-body>
<xsl:apply-templates select="list"/>
</fo:table-body>
</fo:table>
</xsl:template>
<!-- row -->
<xsl:template match="item">
<fo:table-row>
<fo:table-cell border-bottom="1px dashed black">
<fo:block>
<xsl:value-of select="out"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
<!-- the different headers -->
<xsl:template name="header-initial">
<fo:static-content flow-name="header-initial">
<fo:table background-color="yellow" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="4cm">
<fo:block>Header first page</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="header-first">
<fo:static-content flow-name="header-first">
<fo:table background-color="yellow" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="11cm">
<fo:block>Header first page</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="header-other">
<fo:static-content flow-name="header-other">
<fo:table background-color="red" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="3cm">
<fo:block>Header other pages</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="header-last">
<fo:static-content flow-name="header-last">
<fo:table background-color="blue" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="3cm">
<fo:block>Header last page</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<!-- the different footers -->
<xsl:template name="footer-initial">
<fo:static-content flow-name="footer-initial">
<fo:table background-color="orange" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="106mm">
<fo:block>Footer initial page - ESR</fo:block>
<fo:block>P<fo:page-number/>/
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="footer-first">
<fo:static-content flow-name="footer-first">
<fo:table background-color="yellow" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="3cm">
<fo:block>Footer first page</fo:block>
<fo:block>Page
<fo:page-number/>
of
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
Pages
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="footer-other">
<fo:static-content flow-name="footer-other">
<fo:table background-color="red" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="5cm">
<fo:block>Footer other pages</fo:block>
<fo:block>Page
<fo:page-number/>
of
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
Pages
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
<xsl:template name="footer-last">
<fo:static-content flow-name="footer-last">
<fo:table background-color="blue" width="100%" table-layout="fixed">
<fo:table-body>
<fo:table-row>
<fo:table-cell height="5cm">
<fo:block>Footer last page</fo:block>
<fo:block>Page<fo:page-number/>of
<fo:page-number-citation-last ref-id="last-page-flow-1"/>
<fo:page-number-citation-last ref-id="last-page-flow-2"/>
Pages
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:static-content>
</xsl:template>
</xsl:stylesheet>
我的 XML 有一些简单的数据
<list>
<item>
<out>Test1</out>
</item>
<item>
<out>Test2</out>
</item>
<item>
<out>Test3</out>
</item>
<item>
<out>Test4</out>
</item>
<item>
<out>Test5</out>
</item>
<item>
<out>Test6</out>
</item>
<item>
<out>Test7</out>
</item>
<item>
<out>Test8</out>
</item>
<item>
<out>Test9</out>
</item>
<item>
<out>Test10</out>
</item>
<item>
<out>Test11</out>
</item>
<item>
<out>Test12</out>
</item>
<item>
<out>Test13</out>
</item>
<item>
<out>Test14</out>
</item>
<item>
<out>Test15</out>
</item>
<item>
<out>Test16</out>
</item>
<item>
<out>Test17</out>
</item>
<item>
<out>Test18</out>
</item>
<item>
<out>Test19</out>
</item>
<item>
<out>Test20</out>
</item>
<item>
<out>Test21</out>
</item>
<item>
<out>Test22</out>
</item>
<item>
<out>Test23 -- last on page-first</out>
</item>
<!-- max items on first page -->
<item>
<out>Test24 -- first on page-other/page-last</out>
</item>
<item>
<out>Test25</out>
</item>
<item>
<out>Test26</out>
</item>
<item>
<out>Test27</out>
</item>
<item>
<out>Test28</out>
</item>
<item>
<out>Test29</out>
</item>
<item>
<out>Test30</out>
</item>
<item>
<out>Test31</out>
</item>
<item>
<out>Test32</out>
</item>
<item>
<out>Test33</out>
</item>
<item>
<out>Test34</out>
</item>
<item>
<out>Test35</out>
</item>
<item>
<out>Test36</out>
</item>
<item>
<out>Test37</out>
</item>
<item>
<out>Test38</out>
</item>
<item>
<out>Test39</out>
</item>
<item>
<out>Test40</out>
</item>
<item>
<out>Test41</out>
</item>
<item>
<out>Test42</out>
</item>
<item>
<out>Test43</out>
</item>
<item>
<out>Test44</out>
</item>
<item>
<out>Test45</out>
</item>
<item>
<out>Test46</out>
</item>
<item>
<out>Test47</out>
</item>
<item>
<out>Test48</out>
</item>
<item>
<out>Test49</out>
</item>
<item>
<out>Test50</out>
</item>
<item>
<out>Test51</out>
</item>
<item>
<out>Test52</out>
</item>
<item>
<out>Test53</out>
</item>
<item>
<out>Test54</out>
</item>
<item>
<out>Test55</out>
</item>
<item>
<out>Test56</out>
</item>
<item>
<out>Test57 - last on page-other</out>
</item>
<item>
<out>Test58 -first on page-last</out>
</item>
第二页(蓝色)最后一页之后的空白页(红色),
知道了。如果 "auto" 则页面序列的强制页数将 "Force it to be an even-page if the initial-page-number of the next page-sequence is odd" w3c
因此,由于您的第三页序列的初始页码为 1(奇数),但第二页的最后一页实际上是 5(如果我们省略第一页,则为 3)(也是奇数),所以一个页面将被添加,显然甚至没有将其视为最后(不好)。它将显示第 4 页 (因为它是第 4 页),共 3 页 (因为引用的 ID 在第 3 页).
绕过它的方法是添加一个
force-page-count="no-force"
属性到 fo:page-sequence
s
编辑
如果您还有 blank-or-not-blank="blank"
没有页眉或页脚的条件页面主参考,则添加的页面上不会显示页码。但我知道你宁愿根本没有它。