Skip to content

Instantly share code, notes, and snippets.

@loonix
Created August 25, 2017 07:28
Show Gist options
  • Save loonix/366df03d141a8935b24cdb28f32a1f3c to your computer and use it in GitHub Desktop.
Save loonix/366df03d141a8935b24cdb28f32a1f3c to your computer and use it in GitHub Desktop.
Table of Contents XSL
<xsl:template name="genTOC">
<fo:block break-after="page">
<fo:block space-after="5mm">Table of Contents</fo:block>
<xsl:for-each select="//PATH">
<fo:block text-align-last="justify">
<xsl:value-of select="./Name" />:
<fo:basic-link internal-destination="{generate-id(.)}">
<fo:leader leader-pattern="dots" leader-pattern-width="2mm" />
<fo:page-number-citation ref-id="{generate-id(.)}" />
</fo:basic-link>
</fo:block>
</xsl:for-each>
</fo:block>
</xsl:template>
<xsl:template match="//TEMPLATEHERE">
<fo:block page-break-after="always">
<fo:block >Page</fo:block>
<xsl:for-each select="./PATH">
<fo:inline id="{generate-id()}"></fo:inline>
<!-- ... -->
</xsl:for-each>
</fo:block>
</xsl:template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment