visitor
*** PROTOTYPE *** Iterate over an object and all its contained objects, typically be doing a depth-first traversal. For each identified object, the tag evaluates the 'test' condition on its contained 'visit' tags. Only those tags whose test condition is true have their contents processed.
If the 'select' XPath expression returns more than one object, only the first is written. If the XPath expression selects no objects, then an error occurs, unless the 'default' attribute is specified. If the 'select' XPath expression is malformed, then an error occurs.
Tag Summary |
required |
<c:visitor select="value" var="value">
content to be repeated for each iteration
</c:visitor>
|
full tag |
<c:visitor select="value" var="value">
content to be repeated for each iteration
</c:visitor>
|
Required Attributes |
select |
The XPath expression to evaluate. |
var |
The name of a variable that will contain the current object in the iteration. |
Example |
|
<%-- traverse a model starting at $root. $cur refers to current node --%>
<c:visitor select="$root" var="cur">
<c:visit test="local-name($cur) = 'a'">
content to process of test is true
</c:visit>
... other <c:visit> tags ...
</c:visitor>
|