Creates a forEach function
element. forEach takes an iterator as a nested element, and
calls next() on it a number of times, given by the difference
between its begin and end attributes. If begin and end are missing, then
forEach continues while hasNext() returns true for
its iterator.
forEach adds each value returned by the iterator to a
value list,
and returns the Values wrapped in a value object (a
ValuesValue).
Element Information
| Element class | ForEachConfig |
| Implementation class | ForEachStrategy |
| Nested elements | an iterator |
Attributes
The arithmetic function elements support the same attributes as
dm:list. As well,
forEach supports
| Name | Type | Required | Description |
|---|---|---|---|
| begin | int | yes | The start value for the loop |
| end | int | yes | The end value for the loop |
Examples
<!-- continues until the list is done -->
<dmf:forEach>
<dm:list done="any" name="building">
...
</dm:list>
</dmf:forEach>
<!-- generates a collection that contains 2 elements -->
<dmf:forEach begin="1" end="2">
<dm:iterator reference="buildingsIter"/>
</dmf:forEach>