Difficulty: ★☆☆ (easy)
Keywords: index, indices

Problem

You need two separate indices in your document, a general one and another one for persons.

Solution

Use the type attribute both on indexterm and index. The content of the type attribute can be any value. Usually it is a descriptive name (in our case, “persons” would be fine).

For example, the following paragraph contains two index terms. However, Guido is marked up as a “persons index”:

<para> The Python<indexterm>
   <primary>Python</primary></indexterm> programming
   language was designed by
   Guido van Rossum.<indexterm type="persons">
   <primary>van Rossum, Guido</primary></indexterm>
</para>

Use two index elements at the end of your document to distinguish between the two:

<index/> 1

<index type="persons"> 2
  <title>Persons</title>
</index>

1

Generates the normal index as it has no type attribute.

2

Collects only those index entries that contain a type attribute with the value persons (as with Guido in the above example).

Discussion

Some documents contain two indices, one general and one for persons. This is quite common these days as it simplifies where to find your search term. You can add as many indices as you need, but more than two are normally uncommon.

By default, multiple indices are turned on by the DocBook stylesheets. So no special customization is needed. However, if you want to collect all index terms into one index, set the parameter index.on.type to 0 (zero). In that case, the type attribute has no effect.

See Also


Project@GitHubIssue#6