0
考慮下面的XML:如何在pdf生成之前預處理xsl:fo文件?
<book>
<chapter>
<title>chapter title 1</title>
<id>chapterId1</id>
<content>some content</content>
</chapter>
<chapter>
<title>chapter title 2</title>
<id>chapterId2</id>
<content>some content</content>
</chapter>
</book>
我要生成一本書的目錄。所以,我創建了TOC像這樣:
<xsl:for-each select="book/chapter">
<fo:block>
<xsl:value-of select="title" />
<fo:page-number-citation ref-id="id" >
<xsl:attribute name="ref-id">
<xsl:value-of select="id" />
</xsl:attribute>
</fo:page-number>
</fo:block>
</xsl:for-each>
的ref-id
屬性將被覆蓋上飛和章id的值代替。
這裏的問題是引用的id在文檔中還沒有被識別。因爲我使用相同的<xsl:attribute>
元素來創建在cahpeter塊上設置章節標識。
<fo:block> <!-- the chapter container -->
<xsl:attribute name="id">
<xsl:value-of select="chapter/id" />
</xsl:attribute>
<fo:block>
the chapter content.....
</fo:block>
</fo:block>
如何我進行預處理XSL:FO文件,以便FO:block元素有正確的ID已設置?
謝謝
啊已經看到你的答案了,作品! – jorrebor