4.5. Encoding Indexes

The generation of indexes depends on the markups inserted in the text.

Such markups will be processed afterwards by an external tool and will generate the index. An example of such a tool is the collateindex.pl script (see Section 4.10.1). Details about the process used to generate these indexes are shown in Section 4.10.3.

The indexes have nesting levels. The markup of an index is done by the code Example 4-2.

Example 4-2. Code for the generation of an index


<indexterm>
   <primary>Main level</primary>
   <secondary>Second level</secondary>
   <tertiary>Third level</tertiary>
</indexterm>
      

It is possible to refer to chapters, sections, and other parts of the document using the attribute zone.

Example 4-3. Use of the attribute zone


<section id="encoding-index">
    <title>Encoding Indexes</title>

    <indexterm zone="encoding-index">
      <primary>edition</primary>
      <secondary>index</secondary>
    </indexterm>

    <para>The generation of indexes depend on the inserted markups on the text. </para>
      

The Example 4-3 has the code used to generate the entry of this edition on the index. In fact, since the attribute zone is used, the index statement could be located anywhere in the document or even in a separate file.

However, to facilitate maintenance the entries for the index were all placed after the text to which it refers.

Example 4-4. Usage of values startofrange and endofrange on the attributeclass


    <para>Typing the text normally sometimes there's the need of 
   <indexterm class="startofrange" id="example-band-index">
      <primary>examples</primary>
      <secondary>index</secondary>
   </indexterm>
   mark large amounts of text.</para>

   <para>Keep inserting the paragraphs normally.</para>

   <para>Until the end of the section intended
   to be indexed.
   <indexterm startref="example-band-index" class="endofrange">.
   </para>