XML technologies / DocBook / Generating (X)HTML / Generating tables of contents / Controlling tables of contents
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
To show or hide tables of contents for structural elements, use the parameter generate.toc. The parameter generate.toc contains value pairs as shown below.
Example: The generate.toc parameter (defaults)
<xsl:param name="generate.toc">
appendix toc,title
article/appendix nop
article toc,title
book toc,title,figure,table,example,equation
chapter toc,title
part toc,title
preface toc,title
qandadiv toc
qandaset toc
reference toc,title
sect1 toc
sect2 toc
sect3 toc
sect4 toc
sect5 toc
section toc
set toc,title
</xsl:param>Left column (appendix to set): Identifies the element to include in the table of contents.
Right column (toc etc.): Lists the desired types of contents lists.
Line 3, nop: Disables all contents lists for this element.
Line 5: The element book generates a table of contents and lists of figures, tables, examples and equations.
The parameter generate.toc contains pairs of words separated by any amount of whitespace. The first word names the element whose contents lists are shown or hidden.
The second word is a comma-separated list of keywords. Usually, toc is enough to show the table of contents. Adding title generates the list title, usually Table of Contents, List of Figures, etc. To suppress all lists for an element, use nop.
The parameter generate.toc controls which elements have contents lists. It is usually set in a customization file because command-line entry is cumbersome and error-prone.
To hide lists for the elements appendix, part and preface and show them for book and chapter write:
<xsl:param name="generate.toc">
appendix nop
part nop
preface nop
book toc,title,table,figure,example,equation
chapter toc,title,table,figure
</xsl:param>
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