iterate
Write the tag contents for each in the template input model identified by an XPath expression.
If the 'select' XPath expression selects no objects, then the contents of the tag are not processed. If the XPath expression is not well-formed, then an error results.
If the 'select' XPath expression returns a number, then the body of the loop is processed that number of times, and the variable named by 'var' is set to 1 for the first iteration, and incremented by one for each successive iteration.
If there is a variable in scope with the same name as the value 'var' attribute, then it is hidden during the execution of this tag.
If the JET variable org.eclipse.jet.taglib.control.iterateSetsContext is set and evaluates to a boolean value of true, the iterate tag will set the XPath default context object to the current object in the iteration. Using this feature allows nested XPath expressions to be relative to that object (making them shorter).
Tag Summary |
required |
<c:iterate select="value">
content to be repeated for each iteration
</c:iterate>
|
full tag |
<c:iterate select="value" var="value" delimiter="value">
content to be repeated for each iteration
</c:iterate>
|
Required Attributes |
select |
An XPath expression that returns either a node set (a collection of elements or attributes) or a number. |
Optional Attributes |
var |
A variable name. During each iteration, the value of the variable is an object from the set of objects selected by the 'select' XPath expression. |
delimiter |
A string that is written to the tag's output between iteration of the tag. The text is not written after the last iteration. |
Example |
|
<%-- Iterate over child 'a' elements of $root. $curA refers to each instance --%>
<c:iterate select="$root/a" var="curA">
content to be repeated for each iteration
Value of name: <c:get select="$curA/@name"/>
</c:iterate>
|