Chapter 20. Lists

Table of Contents

List titles
List spacing
List vertical spacing
List horizontal spacing
itemizedlist options
Different bullet symbol
orderedlist options
Different numbering style
Number continuation
List starting number
variablelist options
Variable list formatting in print
Variable list formatting in HTML

Lists are an important and useful feature of DocBook. There are several list elements for different purposes. The most often used list elements are these three:

itemizedlist

A list where each item is displayed with a bullet or other symbol, like a ul list in HTML.

orderedlist

A list where each item is numbered sequentially, like a ol list in HTML.

variablelist

A list where each item has a term and an associated description, like a dl list in HTML.

A complete description of all of DocBook's list elements can be found in DocBook: The Definitive Guide. This chapter focuses on using parameters and customizations to handle these three primary list types.

List titles

Most DocBook list elements take an optional title element to let you label a list. The title appears before any list items and before any prolog elements that appear at the beginning of a list.

For print output, the title is processed in mode="list.title.mode", with the title as the context node. By default, that mode just calls the template named formal.object.heading with the parent list element as its object parameter. The result is that any list title formats like a figure title (without a number label). But if you want to customize how one kind of list title formats, you can create a template in that mode matching on that list type.

Customizing orderedlist titles for print:
<xsl:template match="orderedlist/title" mode="list.title.mode">
  <fo:block font-size="14pt" font-weight="normal"
            xsl:use-attribute-sets="normal.para.spacing">
    <xsl:apply-templates/>
  </fo:block>
</xsl:template>

For HTML output, you should copy the formal.object.heading template from html/formal.xsl to your customization layer and modify it as needed. In that template, the context node is the list element, not the title element. You can make the processing conditional on the list type by using an xsl:choose statement:

...
<xsl:choose>
  <xsl:when test="$object/self::orderedlist">
    <!-- processing steps for orderedlist -->
  </xsl:when>
  <xsl:otherwise>
    <!-- processing steps for other formal object headings -->
  </xsl:otherwise>
</xsl:choose>