6.8. Index terms
Creating index terms by hand (other than copying an index term to paste it elsewhere) is tedious and error prone. It's strongly recommended to use the specialized dialog box of XMLmind XML Editor to do that.
An index term is represented by
a a
element having attribute
class="role-index-term"
containing
text —the primary word or phrase in an index term— and possibly nested span
elements having the following roles:
"role-term
", "role-see
", "role-see-also
".
index_term -> end_of_range | term end_of_range -> <a class="role-index-term" data-end-range="range_name"/> term -> <a class="role-index-term" term_attributes>term_content</a> term_attributes -> [ data-sort-as="text" ]? [ data-start-range="range_name" ]? term_content -> rich_text term_childs term_childs -> [ sub_term ]? | [ see ]* | [ see_also ]* sub_term -> <span class="role-term" term_attributes>term_content</span> see -> <span class="role-see">see_content</span> see_also -> <span class="role-see-also">see_content</span> see_content -> rich_text see_child see_child -> [ <span class="role-term">rich_text see_child</span> ]?
In the above grammar:
- "Rich text" means the mix of text and phrase elements
(
b
,i
,em
, etc) allowed ina
andspan
elements. - Though the grammar allows
<span class="role-term"
> to be nested to an arbitrary depth, a<a class="role-index-term">
may contain only up two nested<span class="role-term">
, corresponding respectively to the secondary word and tertiary word of an index term. The same limit applies to<span class="role-see">
and to<span class="role-see-also">
.
Examples:
- Simplest index term containing just a phrase:
<a class="role-index-term">Dog, man's best friend</a>
- “Sort-as” example:
1 2
<a class="role-index-term" data-sort-as="percent">%</a>
- Index terms having primary, secondary and tertiary terms:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<a class="role-index-term"><b>Pet</b> <span class="role-term">Cat</span> </a> ... <a class="role-index-term"><b>Pet</b> <span class="role-term">Cat <span class="role-term">Siamese</span> </span> </a> ... <a class="role-index-term"><b>Pet</b> <span class="role-term">Cat <span class="role-term">Burmese</span> </span> </a>
- Start of the "
dogs
" range:1 2 3
<a class="role-index-term"><b>Pet</b> <span class="role-term" data-start-range="dogs">Dog</span> </a>
- End of the above "
dogs
" range. The end of a range must be found after the corresponding start of range in the same input HTML page or in a different input HTML page:<a class="role-index-term" data-end-range="dogs"></a>
Notice that an end of range index term does not contain text nor any child element. It just has a "
data-end-range
" attribute. - “See” example:
1 2 3 4 5
<a class="role-index-term"><i lang="la">Felis catus</i> <span class="role-see">Pet <span class="role-term">Cat</span> </span> </a>
- “See also” example:
1 2 3 4 5 6
<a class="role-index-term"><i lang="la">Canis lupus</i> <span class="role-see-also">Dog, man's best friend</span> <span class="role-see-also">Pet <span class="role-term">Dog</span> </span> </a>