14.8.2.4 Using an alternate macro to generate XML tags
As an alternative, a somewhat simpler version of macro [ProcIXtext]uses the trim operator instead of the length operator, and steps through the index entry character by character; see §28.6.5 Specifying substrings in expressions:
This version uses <$_repeat> for the inner loop, which allows the inner loop to be nested in the same macro, eliminating the need for a second macro; see §28.6.4.3 Using loop structures.
Colons used as text are output on line 7; all other text is output on line 13, one character at a time. Surrounding XML tags are output on line 3 and line 17.
> 14 Converting to generic XML > 14.8 Converting index entries to generic XML > 14.8.2 Defining macros to process index content > 14.8.2.4 Using an alternate macro to generate XML tags