[英]xsl-fo remove page number from first page
新手問題,但我真的找不到適用於我的 pdf 的 awenser。 我想讓我的頁碼從第 2 頁開始,我該怎么做 go 呢?
這是我的 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>
我希望頁碼保留在頁腳部分。 [:[輸入圖像當前 output:][1]][1] :[![輸入圖像所需輸出][2]][2]
Current output [1]: https://i.stack.imgur.com/JN3ar.png Desired output [2]: https://i.stack.imgur.com/paCVh.png
您的頁腳來自<fo:static-content flow-name="xsl-region-after">
。 每個頁面都使用單個fo:simple-page-master
,因此每個頁面都有頁腳。
您可以為沒有fo:region-after
或具有不同region-name
值的fo:region-after
的第一頁添加第二個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">
另見:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.