我有以下文檔結構,我想生成一個適合我的XSLT轉換的目錄。我嘗試了很多東西,但都沒有爲我工作。有人能幫助我嗎?XSL-FO - 如何生成目錄?
隨着下面的轉換,我得到這個警告和空的頁碼在這個地方。
WARNING: Page 2: Unresolved id reference "N65898" found.
Document structure
<article>
<chapter>
<title>Chapter 1</title>
<para>chapter 1 text</para>
<sect1>
<title>Section1 1.1</title>
<para>text 1.1</para>
<sect2>
<title>Section2 1.1.1</title>
<para>text 1.1.1</para>
</sect2>
<sect2>
<title>Section2 1.1.2</title>
<para>text 1.1.2</para>
</sect2>
<sect2>
<title>Section2 1.1.3</title>
<para>text 1.1.3</para>
</sect2>
<sect2>
<title>Section2 1.1.4</title>
<para>text 1.1.4</para>
</sect2>
</sect1>
<sect1>
<title>Section1 1.2</title>
<sect2>
<title>Section2 1.2.1</title>
</sect2>
<sect2>
<title>Section2 1.2.2</title>
<sect3>
<title>Section3 1.2.2.1</title>
</sect3>
<sect3>
<title>Section3 1.2.2.2</title>
</sect3>
</sect2>
</sect1>
</chapter>
<chapter>
<title>Chapter 2</title>
<sect1>
<title>Section1 2.1</title>
<sect2>
<title>Section2 2.1.1</title>
</sect2>
<sect2>
<title>Section2 2.1.2</title>
<sect3>
<title>Section3 2.1.2.1</title>
</sect3>
<sect3>
<title>Section3 2.1.2.2</title>
</sect3>
</sect2>
</sect1>
<sect1>
<title>Section1 2.2</title>
<sect2>
<title>Section2 2.2.1</title>
</sect2>
<sect2>
<title>Section2 2.2.2</title>
<sect3>
<title>Section3 2.2.2.1</title>
</sect3>
<sect3>
<title>Section3 2.2.2.2</title>
</sect3>
</sect2>
</sect1>
</chapter>
<chapter>
<title>Chapter 3</title>
<sect1>
<title>Section1 3.1</title>
<sect2>
<title>Section2 3.1.1</title>
</sect2>
<sect2>
<title>Section2 3.1.2</title>
<sect3>
<title>Section3 3.1.2.1</title>
</sect3>
<sect3>
<title>Section3 3.1.2.2</title>
</sect3>
</sect2>
</sect1>
<sect1>
<title>Section1 3.2</title>
<sect2>
<title>Section2 3.2.1</title>
</sect2>
<sect2>
<title>Section2 3.2.2</title>
<sect3>
<title>Section3 3.2.2.1</title>
</sect3>
<sect3>
<title>Section3 3.2.2.2</title>
</sect3>
</sect2>
</sect1>
</chapter>
</article>
Transformation
<!-- table of contents -->
<fo:block break-before='page'>
<fo:block font-size="16pt" font-weight="bold">TABLE OF CONTENTS</fo:block>
<xsl:for-each select="//chapter">
<fo:block text-align-last="justify">
<fo:basic-link internal-destination="{generate-id(.)}">
<xsl:value-of select="count(preceding::chapter) + 1" />
<xsl:text> </xsl:text>
<xsl:value-of select="title" />
<fo:leader leader-pattern="dots" />
<fo:page-number-citation ref-id="{generate-id(.)}" />
</fo:basic-link>
</fo:block>
</xsl:for-each>
</fo:block>
@empo TOC轉換不存在。這是錯的,所以我刪除了它... – user219882
@empo我更新了這個問題。這是我所能得到的。 – user219882