我正在使用 XSL-FO 标记生成运行磁头,但在检索书名时遇到了问题。我有一个解决方法,但我认为必须有一个更优雅的解决方案。由于书名仅在书的开头显示为文本,因此我的标记与我的静态内容不在同一个页面序列中。是否有检索页外序列标记的机制?
我正在为我的 PDF 生成使用 XSLT Formatter V 4.3,但我并没有与之结婚。
一个非常简化的 XML 示例:
<book>
<bktitle>Alice in Wonderland</bktitle>
<chapter>
<chaptitle>Chapter 1</chaptitle>
<para>This is the story of Alice in Wonderland.</para>
</chapter>
</book>
XSL-FO 的片段:
<fo:page-sequence master-reference="fm">
<fo:title>Alice in Wonderland</fo:title>
<fo:flow flow-name="xsl-region-body">
<fo:block font-variant="small-caps">
<fo:marker marker-class-name="book">Alice in Wonderland</fo:marker>Alice in Wonderland</fo:block>
</fo:flow>
</fo:page-sequence>
<fo:page-sequence master-reference="body">
<fo:title>Chapter 1</fo:title>
<fo:static-content flow-name="header">
<fo:block><fo:retrieve-marker retrieve-class-name="book"/></fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<fo:block font-variant="small-caps">
<fo:marker marker-class-name="chapter">Chapter 1</fo:marker>Chapter 1</fo:block>
<fo:block>This is the story of Alice in Wonderland.</fo:block>
</fo:flow>
</fo:page-sequence>