xsl-fo 从第一页删除页码

xsl-fo remove page number from first page

新手问题,但我真的找不到适合我的 pdf 的文具。 我想让我的页码从第 2 页开始,我该怎么做?

这是我的 xsl 文件

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="catalog">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="A4" page-height="7in" page-width="15in">
                    <fo:region-body margin="1in" background-color="#f2f2f2"/> 
                    <fo:region-before extent="1in" background-color="#dadada"  border-before-style ="solid"/>
                    <fo:region-after extent="1in" background-color="#c1c1c1 "  border-after-style  ="solid"/>
                    <fo:region-start extent="1in" background-color="#c1c1c1 "/>
                    <fo:region-end extent="1in" background-color="#c1c1c1"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence master-reference="A4" initial-page-number="1">
        
        <fo:static-content flow-name="xsl-region-start">
             <fo:block>
                <xsl:text>BEST MUSIC</xsl:text>
            </fo:block>
            </fo:static-content>
            
                <fo:static-content flow-name="xsl-region-end">
             <fo:block>
                <xsl:text>CATALOG</xsl:text>
            </fo:block>
            </fo:static-content>
            
               <fo:static-content flow-name="xsl-region-after">
                <fo:block text-align="center">
                    Page <fo:page-number/>
                    of <fo:page-number-citation ref-id="terminator"/>
                </fo:block>
            </fo:static-content>
     
                <fo:flow flow-name="xsl-region-body">
                        <fo:table>
                        <fo:table-column column-width="60mm" />
                        <fo:table-column column-width="60mm" />
                        <fo:table-column column-width="60mm" />
                        <fo:table-column column-width="60mm" />
                        <fo:table-column column-width="60mm" />
                        <fo:table-column column-width="60mm" />
                        <fo:table-column column-width="60mm" />
                            <fo:table-header border="1 solid black">
                                <fo:table-row background-color="lightyellow" border="1 solid black">
                                    <fo:table-cell>
                                        <fo:block font-weight="bold">Title</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block font-weight="bold">Artist </fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block font-weight="bold">Company</fo:block>
                                    </fo:table-cell>
                                        <fo:table-cell>
                                        <fo:block font-weight="bold">Country</fo:block>
                                    </fo:table-cell>
                                        <fo:table-cell>
                                    <fo:block font-weight="bold">Year</fo:block>
                                </fo:table-cell>
                                        <fo:table-cell>
                                    <fo:block font-weight="bold">Price</fo:block>
                                </fo:table-cell>
                                    
                                </fo:table-row>
                            </fo:table-header>
                            <xsl:for-each select="cd">
                                <fo:table-body border="1 dotted black">
                                
                                    <fo:table-row>
                                        <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="title"/> 
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="artist"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="company"/>
                                            </fo:block>
                                        </fo:table-cell>
                                        <fo:table-cell>
                                            <fo:block>
                                            <xsl:value-of select="country"/>
                                            </fo:block>
                                        </fo:table-cell>
                                            <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="year"/> 
                                            </fo:block>
                                        </fo:table-cell>
                                            <fo:table-cell>
                                            <fo:block>
                                                <xsl:value-of select="price"/> 
                                            </fo:block>
                                        </fo:table-cell>
                                        
                                    </fo:table-row>
                                </fo:table-body>
                            </xsl:for-each>
                        </fo:table>
                           <fo:block id="terminator"></fo:block>
                </fo:flow>
                </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>

我希望页码保留在页脚部分。 [![enter image 当前输出:][1]][1] :[![输入图像所需的输出][2]][2]

当前输出[1]:https://i.stack.imgur.com/JN3ar.png 期望的输出 [2]:https://i.stack.imgur.com/paCVh.png

您的页脚来自 <fo:static-content flow-name="xsl-region-after">。每个页面都使用单个 fo:simple-page-master,因此每个页面都有页脚。

您可以只为没有 fo:region-afterfo:region-afterregion-name 值不同的第一页添加第二个 fo:simple-page-master

<fo:simple-page-master master-name="First" page-height="7in" page-width="15in">
  <fo:region-body margin="1in" background-color="#f2f2f2"/> 
  <fo:region-before extent="1in" background-color="#dadada"  border-before-style ="solid" />
  <fo:region-after region-name="First-footer" extent="1in" background-color="#c1c1c1 "  border-after-style  ="solid"/>
  <fo:region-start extent="1in" background-color="#c1c1c1 "/>
  <fo:region-end extent="1in" background-color="#c1c1c1"/>
</fo:simple-page-master>

要在第一页使用 fo:simple-page-master,请添加一个 fo:page-sequence-master,为第一页选择正确的 fo:simple-page-master

<fo:page-sequence-master master-name="PageMaster">
  <fo:repeatable-page-master-alternatives>
    <fo:conditional-page-master-reference master-reference="First" page-position="first" />
    <fo:conditional-page-master-reference master-reference="A4" />
  </fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>

你的 fo:page-sequence 应该引用 fo:page-sequence-master 而不是直接引用固定的 fo:simple-page-master:

<fo:page-sequence master-reference="PageMaster" initial-page-number="1">

另见: