D.4. 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 B.6.2). Details about the process used to generate these indexes are shown in Section B.6.2.

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

Example D-3. 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 D-4. 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 D-4 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 D-5. 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>