次のxmlを検討してください。
<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>
要素を使用して、キャペッター ブロックにチャプター ID のセットを作成するためです。
<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>
fo:block 要素に正しい ID が既に設定されているように、xsl:fo ファイルを前処理するにはどうすればよいですか?
ありがとうございました