XML technologies / DocBook / Generating (X)HTML / Generating tables of contents / Numbering chapters and sections

(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)

By default, parts and chapters are numbered, but sections are not. Stylesheet parameters control numbering. The value 1 enables the parameter; the value 0 disables it.

Table: Numbering parameters

Parameters

Description

part.autolabel

controls automatic part numbering; the default is 1

chapter.autolabel

controls automatic chapter numbering; the default is 1

preface.autolabel

controls automatic preface numbering; the default is 0

appendix.autolabel

controls automatic appendix numbering; the default is 1

section.autolabel

controls automatic section numbering; the default is 0

section.label.includes. component.label

controls automatic numbering within the section’s component; the default is 0

qandadiv.autolabel

controls automatic numbering of qandasets; the default is 1

label.from.part

If this parameter is set to 1, chapter, appendix and others are reset in each part to 1. Otherwise (value 0), they are numbered continuously throughout the book.

The following examples show the effects and interaction of these parameters.

With unchanged parameters, a book with these chapters produces the following numbering:

<!-- Standard -->
Vorwort
I. Grundlagen
  1. Einführung in XML
     Geschichtliches zu SGML, HTML und XML
     XML in 10 Punkten
     Geschichtliches zu SGML, HTML und XML
II. Dokumentmodelle
  2. Dokumententyp-Definitionen
     Vergleich zwischen DTDs und Schemata
     Aufbau einer DTD
     Geschichtliches zu SGML, HTML und XML
A. Schnellübersicht über die DocBook-Elemente

The parameter label.from.part is set to 1:

<!-- label.from.part=1 -->
Vorwort
I. Grundlagen
  1. Einführung in XML
     Geschichtliches zu SGML, HTML und XML
     XML in 10 Punkten
     Geschichtliches zu SGML, HTML und XML
II. Dokumentmodelle
  1. Dokumententyp-Definitionen
     Vergleich zwischen DTDs und Schemata
     Aufbau einer DTD
     Geschichtliches zu SGML, HTML und XML
A. Schnellübersicht über die DocBook-Elemente

Compared with the preceding output, chapter numbering restarts at 1.

To number sections too, use these parameters:

<!-- label.from.part=1, section.autolabel=1 -->
Vorwort
I. Grundlagen
  1. Einführung in XML
     1. Geschichtliches zu SGML, HTML und XML
     2. XML in 10 Punkten
     3. Geschichtliches zu SGML, HTML und XML
II. Dokumentmodelle
  1. Dokumententyp-Definitionen
     1. Vergleich zwischen DTDs und Schemata
     2. Aufbau einer DTD
     3. Geschichtliches zu SGML, HTML und XML
A. Schnellübersicht über die DocBook-Elemente

Sections are now numbered too. To include the chapter number, use:

<!-- section.label.includes.component.label=1,
    section.autolabel=1 -->
Vorwort
I. Grundlagen
  1. Einführung in XML
     1.1. Geschichtliches zu SGML, HTML und XML
     1.2. XML in 10 Punkten
     1.3. Geschichtliches zu SGML, HTML und XML
II. Dokumentmodelle
  2. Dokumententyp-Definitionen
     2.1. Vergleich zwischen DTDs und Schemata
     2.2. Aufbau einer DTD
     2.3. Geschichtliches zu SGML, HTML und XML
A. Schnellübersicht über die DocBook-Elemente

Try the other parameters as an exercise.

  

back to top