arc:enum keyword to enumerate over the attributes in an item, a delimited list, a supplied range of values, or the values of a multi-valued attribute. The body of arc:enum is executed for each element of the set that is being iterated upon.
Parameters
- item: The name of the item whose attributes you want to iterate over.
- attr: The expression to match that specifies which attributes are iterated over. For example,
arc:*. You can also provide this parameter to iterate over the values of a multi-valued attribute. - prefix: The prefix based on which the item is enumerated.
- expand: The boolean value that specifies how
arc:enumbehaves when multi-valued attributes are encountered. If expand is set totrue, the body ofarc:enumis executed once for each value of the attribute. Iffalse, all values are concatenated in a single string value, and a single iteration is performed. By default,arc:enumdoes not expand all values. - sep[arator]: The separator to use to concatenate values of a multi-valued attribute if the expand parameter is
false. This parameter is also used to tokenize the values in a list if listseparator is not defined. The default value is the new-line character (\n). - list: The list of separated values to enumerate over. For example, if the list of values is
violet, indigo, blue, green, yellow, orange, redand the separator is a comma (,), the scope ofarc:enumis executed for each color in the rainbow. - range: The range of numbers or characters to enumerate over in ascending or descending order; for example,
a..zorZ..A.
You can specify either the range or the item parameter, but not both. Attributes are enumerated in alphabetical order.
Control Attributes
- _attr: The name of the attribute being iterated over. When you are iterating over the values of a multi-valued attribute, the attribute name is the same except that it also has the index as part of the name. The index is separated from the name by the hash symbol (
#). For example,name#1,name#2, and so on. - _index: The index at which the attribute appears in an item, or the position of the list element currently being enumerated over.
- _value: The value of the attribute being iterated over. For a multi-valued attribute, the expand and separator parameter settings determine whether _value is a reference to one attribute value or a reference to all attribute values.
- _count: The number of values in an attribute or in a list.
- _separator: The separator used to separate the values in a list.
Examples
Display the attribute names and attribute values of the item namedinput:
colors attribute:
a to z, from Z to A, and the numbers from 1 to 25:
true: