Numeric Counters
Refer to the Numeric counters chapter of the sample file Arbortext-path/samples/ALD/CountersAndVariables/countersAndVariables.xml. The simplelist, member, and function tags each reference a different property set in the associated stylesheet. The property sets in turn include PTC ALD source code edits to manipulate numeric counters. Access the source code for the property set by selecting it in the Property Sets list, and using the > > menu option.
Reset the value of the numeric counter
Refer to the simplelist elements in the chapter. In the associated stylesheet, the simplelist everywhere context references the NumericCounterReset property set. This property set resets the value of a numeric counter to 0. This will ensure that the value of that numeric counter is 0 at the start of every simplelist in the document. The relevant code in that property set is given below.
formatting.counters[10] = 0;
Here you are accessing the numeric counter slot numbered 10, and setting its value to 0. As mentioned previously, numeric counters are accessed via the counters property of the fFormatting object. The number in the square brackets is the counter slot you wish to use (from 10 to 199).
Increment the value of the numeric counter
Refer to the member elements in the simplelist. In the associated stylesheet, the member everywhere context references the NumericCounterIncrement property set. This property set increments the value of a numeric counter by 1. This will ensure that the value of that numeric counter will increase by 1 at the start of every member element of a simplelist. The relevant code in that property set is given below.
formatting.counters[10] ++;
Here you are accessing the numeric counter slot numbered 10, and increasing its value by 1.
Output the current value of the numeric counter
Refer to the function element in a member. In the associated stylesheet, the function everywhere context references the NumericCounterDisplay property set. This property set outputs the current value of the numeric counter. The member elements in a simplelist will display consecutive numbers, each output by their function child element. The relevant code in that property set is given below.
formatting.write(formatting.counters[10]);
Here you are calling the write() method of the fFormatting object to output the value of the numeric counter slot numbered 10.