Archive for the ‘XSL:FO’ Category

Creating a Table of Contents in XSL:FO

Thursday, August 16th, 2007

Yesterday I needed to produce a table of contents for a PDF file generated using Apache FOP. First of all I got in a mess over list-items where the my page numbers were underneath my titles and unreadable. I then moved onto using leading and justification to produce a perfect table of contents look. I have pasted an example of this technique below.

<xsl:for-each select="entry">
<fo:block text-align-last="justify">
<xsl:value-of select="title"/>
<fo:leader leader-pattern="dots"/>
<fo:page-number-citation ref-id="{@id}"/>
</fo:block>
</xsl:for-each>