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>

  

back to top