#### 37.4.3 Initializing list variables

To preset values for list-variable items, create a configuration-file section for the list variable, and use the section to populate the list with indexes and corresponding values. For example:

[MyList]
1 = First
abc = Alpha start
xyz = Alpha end
0 = Default
mno = middle

With these settings, the initial value of <$$MyList[1]> would be First and the initial value of <$$MyList[mno]> would be middle. The initial value of <$$MyList[ghi]> would be Default, because no value has been provided for an index named ghi (see §37.4.2 Assigning a value to a list-variable item).

Suppose you set <$$MyList[1]=Second> in a macro. If this macro or another macro subsequently refers to <$$MyList[1]> while DITA2Go is processing the same DITA file, the value is Second, not First. But the value in the configuration file does not change, so when DITA2Go processes the next DITA file, the initial value of <$$MyList[1]> is First again. That is, the new value Second is in effect for the rest of the current DITA file, but is not stored for use in the next.

Previous Topic: 37.4.2 Assigning a value to a list-variable item

Next Topic: 37.4.4 Using macros to process lists

Parent Topic: 37.4 Using multiple-value list variables

Sibling Topics:

37.4.1 Understanding list-variable syntax

37.4.2 Assigning a value to a list-variable item

37.4.4 Using macros to process lists

37.4.5 Using pointers to process lists

37.4.6 Using a list instead of a conditional expression

Table of Contents • Index