<indexterm>

An <indexterm> element contains content that is used to produce an index entry. Nested <indexterm> elements create multi-level indexes.

Rendering expectations

The content of @indexterm entries is not rendered in the flow of body text; it is rendered only as part of an index.

Content model

(Text | <data> | <sort-as> | <foreign> | <keyword> | <term> | <text> | <ph> | <strong> | <em> | <b> | <i> | <line-through> | <overline> | <sup> | <sub> | <tt> | <u> | <indexterm> | <index-see> | <index-see-also> )*

Attributes

The following attributes are available on this element: universal attributes, @keyref, and the attributes defined below.

@start
Specifies an identifier that indicates the start of an index range.
@end
Specifies an identifier that indicates the end of an index range.

The following attributes are available on this element: universal attributes and the attributes defined below.

@end
Specifies an identifier that indicates the end of an index range.
@keyref
Specifies a key name that acts as a redirectable reference based on a key definition within a map. See The keyref attribute for information on using this attribute.
@start
Specifies an identifier that indicates the start of an index range.

Examples

This section is non-normative.

This section contains examples of how <indexterm> elements can be used.

Example 1. Index reference to a point within in a topic

When index entries are placed in the body of a topic, they serve as point references to their location in the topic.

In the following code sample, the <indexterm> element provides a point reference to the beginning of the paragraph.

<p><indexterm>databases</indexterm>Databases are used to ...</p>
Example 2. Index entries within topic prologues or DITA maps

When index entries are located within the <prolog> element in a topic or the <topicmeta> element in a DITA map, they serve as point references to the start of the topic title.

In the following code sample, the <indexterm> element provides a reference to the topic as a whole; the generated index entry is associated with the start of the <title> element.

<topic id="about-databases">
  <title>About databases</title>
  <prolog>
    <metadata>
      <keywords>
        <indexterm>databases</indexterm>
      </keywords>
    </metadata>
  </prolog>
  <body>
    <!-- content... -->
  </body>
</topic>

The effect is the same as if the <indexterm> element had been located in the map:

<map>
  <topicref href="aboutdatabases.dita">
    <topicmeta>
      <keywords>
        <indexterm>databases</indexterm>
      </keywords>
    </topicmeta>
  </topicref>
  <!-- ... -->
</map>
Example 3. A simple index range

A simple index range will look something like this:

<indexterm start="cheese">cheese</indexterm>
<!-- ... additional content -->
<indexterm end="cheese"/>

This markup will generate a top-level index term for "cheese" that covers a series of pages, such as:

cheese 18-24

Example 4. A more complex index range

Specifying a range for nested terms is similar. In this sample, the range is specified for the tertiary index entry "pecorino":

<indexterm>cheese
  <indexterm>sheeps milk
    <indexterm start="level-3-pecorino">pecorino</indexterm>
  </indexterm>
</indexterm>
 <!-- ... additional content ... -->
<indexterm end="level-3-pecorino"/>