我正在使用XSLT-FO制作一封信(pdf)。在第一页上,我有公司徽标/图像和信件内容的开头。我不想在任何其他页面上显示徽标,所以我使用的是可重复页面主页替代品。问题是它在下一页重复文本块(smf:body)而不是从第一页继续它。我已经做了很多互联网搜索,试图找到原因 - 但我无法解决。这是一个XSL-FO:
<xsl:template match="/smf:workItem">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="first-page" page-height="29.7cm" page-width="21cm" margin-top="0.5cm" margin-bottom="1cm" margin-left="1.75cm">
<fo:region-body margin-right="2cm" margin-top="1.27cm" margin-bottom="1mm" />
<fo:region-before region-name="header-first" extent="0mm" />
<fo:region-after region-name="footer-first" extent="0mm" />
<fo:region-end border-top-width="5pt" region-name="right-sidebar" writing-mode="tb-rl" extent="10mm" />
</fo:simple-page-master>
<fo:simple-page-master master-name="all-pages" page-height="29.7cm" page-width="21cm" margin-top="0.5cm" margin-bottom="1cm" margin-left="1.75cm">
<fo:region-body margin-left="0.25cm" margin-right="2cm" margin-top="1.27cm" margin-bottom="1mm" />
<fo:region-before region-name="header-normal" extent="0mm" />
<fo:region-after region-name="footer-normal" extent="0mm" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="document" font-family="Helvetica">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference page-position="first" master-reference="first-page"/>
<fo:conditional-page-master-reference page-position="any" master-reference="all-pages" />
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<!--
<fo:page-sequence-master master-name="document" font-family="Helvetica">
<fo:single-page-master-reference master-reference="first-page"/>
<fo:repeatable-page-master-reference master-reference="all-pages"/>
</fo:page-sequence-master>
-->
</fo:layout-master-set>
<fo:page-sequence master-reference="document">
<fo:static-content flow-name="header-first" font-size="10pt">
<fo:external-graphic src="url('C:\Program Files (x86)\numerointeractive\whitemail\Images\club1830.jpg')" />
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="10pt" linefeed-treatment="preserve" white-space-collapse="false" white-space-treatment="ignore-if-surrounding-linefeed" wrap-option="wrap">
<xsl:value-of select="smf:body"/>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
请有人帮我解决这个问题。块(smf:body)位于定义我的布局的页面序列中,但由于某种原因,它会重复它。任何帮助将非常感谢。
感谢。
ps - 我也尝试过使用单个/可重复的页面母版,但它的行为相同
答案 0 :(得分:0)
您可以将第一页创建为封面,而不将其包含在fo:repeatable-page-master-alternatives元素中。看看一个例子:
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="Cover" margin="1in" page-height="11in" page-width="8.5in">
<fo:region-body margin-top="2in"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="StoriesOdd" page-height="11in" page-width="8.5in"
margin=".5in">
<fo:region-body margin=".5in"/>
<fo:region-before region-name="oddHead" extent=".5in"/>
<fo:region-after region-name="oddFoot" extent=".5in"/>
</fo:simple-page-master>
<fo:simple-page-master master-name="StoriesEven" page-height="11in" page-width="8.5in"
margin=".5in">
<fo:region-body margin=".5in"/>
<fo:region-before region-name="evenHead" extent=".5in"/>
<fo:region-after region-name="evenFoot" extent=".5in"/>
</fo:simple-page-master>
<fo:page-sequence-master master-name="Stories">
<fo:repeatable-page-master-alternatives>
<fo:conditional-page-master-reference master-reference="StoriesOdd" odd-or-even="odd"/>
<fo:conditional-page-master-reference master-reference="StoriesEven" odd-or-even="even"/>
</fo:repeatable-page-master-alternatives>
</fo:page-sequence-master>
<fo:page-sequence-master master-name="CoverPage">
<fo:single-page-master-reference master-reference="Cover"/>
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="CoverPage">
<fo:flow flow-name="xsl-region-body">
<fo:block text-align="center" font-weight="bold" font-size="1in"> Cover Page </fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="Stories">
<fo:static-content flow-name="oddHead">
<fo:block border-bottom-width="thin" border-bottom-style="solid" border-bottom-color="green"
font-weight="bold" text-align="outside"> Story Title </fo:block>
</fo:static-content>
<fo:static-content flow-name="evenHead">
<fo:block border-bottom-width="thin" border-bottom-style="solid" border-bottom-color="green"
font-weight="bold" text-align="outside"> Book of Stories </fo:block>
</fo:static-content>
<fo:static-content flow-name="oddFoot">
<fo:block border-bottom-width="thin" border-bottom-style="solid" border-bottom-color="green"
font-weight="bold" text-align="outside">
<fo:page-number/> | </fo:block>
</fo:static-content>
<fo:static-content flow-name="evenFoot">
<fo:block border-bottom-width="thin" border-bottom-style="solid" border-bottom-color="green"
font-weight="bold" text-align="outside"> | <fo:page-number/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block/>
</fo:flow>
</fo:page-sequence>
</fo:root>