Chapter 17. Glossaries

Table of Contents

Glossary formatting
Glossary formatting in print
Linking to a glossary entry
What about link and xref?
Glossary database
Glossary database catalog entry
Links in a glossary collection
Glossary sorting

The DocBook XSL stylesheets have some special features for glossaries. In addition to formatting glossary elements and their glossentrys, they let you form cross references from your text to glossary entries, sort glossary entries, and create a separate glossary database.

Glossary formatting

These formatting options are available for both HTML and print output.

  • The title and start of a glossary is considered a glossary title page. It can be controlled by the same title page customization methods as other components, and described in Chapter 11, Title page customization.

  • You can divide a glossary into sections using glossdiv wrappers around groups of glossentry elements. You must give each glossdiv a title.

  • If your glossentry elements include an abbrev or acronym element, then you can control how it appears with the parameter. Its values can be:


    Put the abbrev or acronym first, followed by the glossterm in parentheses.


    Put the glossterm first, followed by the abbrev or acronym in parentheses.


    do not show the abbrev or acronym at all.

If your entry has both abbrev and acronym, then both will appear in the output.

Glossary formatting in print

In addition to the above features, the print stylesheet supports these additional formatting features.

  • You can format a glossary as a list with the terms to the left of the indented definition paragraphs, or as blocks with each term stacked above its unindented paragraph. By default, a glossary is formatted as a list. If you want to change all of your glossaries to format as blocks, set the stylesheet parameter to a nonzero value. If you are using a glosslist instead of a glossary element, then use the parameter instead. You can also control how an individual glossary is presented by using a processing instruction inserted into that glossary element in your document. The following is an example:

    <?dbfo glossary-presentation="blocks" ?>

    You can set the value to list to format one glossary as a list when the parameter formats the rest as blocks. For a glosslist, the processing instruction name is glosslist-presentation, and it takes the same values. In all cases, the processing instruction overrides the stylesheet parameter for an individual glossary.

  • If your glossary is formatted as a list, you can control the indent of the definition paragraphs to allow space for the terms. The glossterm.width stylesheet parameter sets the indent for all glossary and glosslist elements. Its default value is 2in. You can also set the indent width for an individual glossary using a processing instruction, as in this example.

    <?dbfo glossterm-width="3.5cm" ?>
  • For a glossary formatted as a list, you can also control the minimum size of the space separating the term from the paragraph. That value is controlled by the glossterm.separation parameter, and its default value is 0.25in. There is no processing instruction for this feature.