#### 14.8.2.5 Stripping character formats from index entries

Still another version of macro [ProcIXtext] removes character-format names from index-marker content, as well as processing colons:

| [ProcIXtext] |
1 | <$$IXlevel = 1> |
2 | <$_while ($$IXtext)> |
3 | <index<$$IXlevel>> | Opening XML tag
4 | <$_repeat> |
5 | <$_if not ($$IXtext)><$_break> |
6 | <$_elseif ($$IXtext starts "\\:")> |
7 | : | Text colon output
8 | <$$IXtext = ($$IXtext trim first 3)> |
9 | <$_elseif ($$IXtext starts ":")> |
10 | <$$IXtext = ($$IXtext trim first)> |
11 | <$_break> |
12 | <$_elseif ($$IXtext starts "<")> |
13 | <$$IXtext = ($$IXtext after ">")> |
14 | <$_else> |
15 | <$($$IXtext first)> | Text character output
16 | <$$IXtext = ($$IXtext trim first)> |
17 | <$_endif> |
18 | <$_endrepeat> |
19 | </index<$$IXlevel>> | Closing XML tag
20 | <$$IXlevel++> |
21 | <$_endwhile> |

This version uses a negative conditional expression to check for the end of each index entry, and uses the starts operator instead of the first operator; see:

§28.6.4.2 Using conditional expressions

§28.6.5 Specifying substrings in expressions)

Text colons are output on line 7; all other text is output on line 15, one character at a time.

Some first (line 15) and trim first (line 10 and line 16) expressions in this version appear without a second operand; these expressions assume an implied value of 1 (one) for the second operand.

| 14.8.2.4 Using an alternate macro to generate XML tags |  | 15 Converting to DITA XML |