XML technologies / DocBook / Block elements / Index entries / Index ranges
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
For topics spanning several paragraphs or sections, index ranges help readers locate the coverage. Print output shows starting and ending pages; online output uses the sections containing the endpoints. DocBook offers two methods:
-
startofrange,startrefandendofrange At the start of a range, insert an
indextermwith the attributeclasswith the valuestartofrange. Give thisindexterman anchor. At the end of the range, insert a second, empty<indexterm/>. Add the attributestartrefwith the anchor of the firstindexterm.-
zone First add anchors to the elements to index. At a suitable position, usually the start of a chapter, insert an
indexterm. Also use the attributezone, containing the space-separated anchor values of the indexed elements. The type ofzoneis IDREFS, allowing references to several anchors.
The following example illustrates this initially complex-looking mechanism:
Example: Index ranges using startofrange, endofrange and startref
<chapter>
<title>DocBook</title>
<indexterm ANKER="id.chap.xml"class="startofrange">
<primary>DocBook</primary>
</indexterm>
<!-- weiterer Inhalt -->
<indexterm startref="id.chap.xml"class="endofrange"/>
</chapter>Replace the placeholder ANKER with id in DocBook 4 and xml:id in DocBook 5.
Note: Placing the empty <indexterm/>
Place empty <indexterm/> elements carefully. If a chapter or appendix contains sections, place the <indexterm/> element in the last section to avoid validation errors.
This method creates a from-to range in the index. Printed documents use page numbers.
The second method uses the zone attribute, useful for collecting all index entries in one place:
Example: Index ranges using zone
<chapter>
<title>DocBook</title>
<indexterm zone="sec.install sec.config">
<primary>DocBook</primary>
</indexterm>
<sect1 ANKER="sec.install">
<title>Installation</title>
<para>...</para>
</sect1>
<sect1 ANKER="sec.config">
<title>Konfiguration</title>
<para>...</para>
</sect1>
</chapter>Replace the placeholder ANKER with id in DocBook 4 and xml:id in DocBook 5.
The example creates the main entry "DocBook" with two subentries, "Installation" and "Konfiguration".
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top