XML technologies / DocBook / Generating FO (PDF) / Displaying tables of contents / Customizing the table of contents
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
The default table of contents is fairly plain. To display chapter and appendix entries in bold and a larger font, for example, add the following code to your customization file:
<xsl:attribute-set name="toc.line.properties">
<xsl:attribute name="font-size">
<xsl:choose>
<xsl:when test="self::d:chapter | self::d:preface | self::d:appendix">
<xsl:value-of select="$body.font.master * 1.2"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$body.font.master"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>pt</xsl:text>
</xsl:attribute>
<xsl:attribute name="font-weight">
<xsl:choose>
<xsl:when test="self::d:chapter | self::d:preface | self::d:appendix">bold</xsl:when>
<xsl:otherwise>normal</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:attribute-set>Line 1: Attribute set for all table of contents entries, regardless of element.
Line 2: Sets the font size. For an appendix, preface or chapter, the font size specified in the parameter body.font.master is multiplied by 1.2. If the test is false, the original size is used.
Line 13: Sets the emphasis. As above, bold is used only when the current element is an appendix, preface or chapter. All other elements use normal text.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top