Previous Chapter | Next Chapter | Up | Next Section | Contents

Variables Defined by the dtml-in Tag


When text is inserted using an dtml-in tag, a copy of the text is inserted for each item in the sequence. Tags in the inserted text have access to variables not available outside the dtml-in tag. These include:

In addition, for each of the variables listed in tables 19, 22, and 23 with names ending in "-index", there exist variables whose names end in "-number", "-roman", "-Roman", "-letter", and "-Letter" which are indexed from 1, "i","I", "a", and "A", respectively. The sequence-index variable is used to number items as text is inserted. Variables like sequence-letter and sequence-roman provide numbering using letters and Roman numerals.

Item variables defined by the dtml-in tag

Name

Description

sequence-item

The current item.

sequence-key

The key associated with the element in an items sequence. An items sequence is a sequence of value pairs that represent a mapping from a key to a value.

sequence-index

The index, starting from 0, of the element within the sequence.

sequence-start

The variable is true if the element being displayed is the first of the displayed elements, and false otherwise. This is useful when text must be inserted at the beginning of an dtml-in tag, especially if the text refers to any variables defined by the dtml-in tag.

sequence-end

The variable is true if the element being displayed is the last of the displayed elements, and false otherwise. This is useful when text must be inserted at the end of an dtml-in tag, especially if the text refers to any variables defined by the dtml-in tag.

There also exist variables ending in "-even" and "-odd", which test whether the sequence index is even or odd. This is useful to display rows more visibly by alternating colors.

Finally, for each of the variables ending in "-index", there are variables whose names end in "-var-xxx", where "xxx" is an element attribute name or key. This is useful when displaying previous- and next-batch information. The construct is also useful if used in an dtml-if tag to test whether or not an attribute is present since the attribute lookup will not be extended to the full document template name space.

Previous Chapter | Next Chapter | Up | Next Section | Contents