Chapter and section numbering

There are several parameters that control numbering of chapter and section titles. By default, chapter titles are numbered but section titles are not. Appendix titles are numbered when in a book, but not numbered by default when in an article. In the DocBook XSL stylesheets, the number part of a title is called a label.

If you prefer to turn off chapter numbering, then set the chapter.autolabel parameter to zero. If you also want to turn off appendix numbering (A, B, C, etc.), then also set the appendix.autolabel parameter to zero.

xsltproc  --output myfile.html  \
  --stringparam  chapter.autolabel 0 \
  --stringparam  appendix.autolabel 0 \
  html/docbook.xsl  myfile.xml

To turn on basic section numbering, set the section.autolabel parameter to 1. Then your titles will be numbered as follows:

Chapter 3. Using a mouse
1.  Basic mouse actions    sect1
1.1  Left button           sect2
1.2  Right button          sect2
1.2.1 Context menus        sect3
2.  Selecting              sect1
2.1  Click and drag
2.2  Double click

Notice that the section numbers do not include the chapter number by default, so section numbering starts over with each new chapter. If you prefer the section numbers to include the chapter number, then set the section.label.includes.component.label parameter to 1. This assumes that you leave chapter numbering turned on. For example:

xsltproc  --output myfile.html  \
  --stringparam  section.autolabel 1 \
  --stringparam  section.label.includes.component.label 1 \
  html/docbook.xsl  myfile.xml

This results in the following numbering style:

Chapter 3. Using a mouse
3.1.  Basic mouse actions    sect1
3.1.1  Left button           sect2
3.1.2  Right button          sect2 Context menus        sect3
3.2.  Selecting              sect1
3.2.1  Click and drag
3.2.2  Double click

Section titles in an appendix will have the appendix letter instead of a chapter number.

Depth of section numbering

You may want to limit the depth of sections that get a section number. If you have deeply nested sections, then the string of numbers in the section label can get quite long. Or perhaps you just want sections at levels 1 and 2 to be numbered, since any lower level sections aren't important enough to have a number label.

You can use the section.autolabel.max.depth parameter to control which section levels get a number label. If you set the parameter to 2, then only sections at levels 1 and 2 will have the label. The default value is 8, meaning all section levels have numbering (if it is turned on).