In certain XPath expressions, it is convenient to iterate over an initial node-set before applying a further test to each node in the resulting set.
In XMLProbe 1.4, this can be achieved using probe:for-each:
<silcn:set-criterion>
<silcn:id>TEST-001</silcn:id>
<silcn:expression>number[. = 'one']</silcn:expression>
<probe:for-each>//numbers</probe:for-each>
<probe:message><probe:eval>.</probe:eval></probe:message>
</silcn:set-criterion>
In the above example, the expression contained in probe:for-each is evaluated first, retrieving all numbers elements in the document. The silcn:expression is then evaluated against each node in the resulting node-set, locating child number elements whose string value is equal to 'one'.
The following also applies to its usage:
the probe:for-each expression must evaluate to a non-empty node-set
the probe:for-each instruction may appear anywhere as a following sibling of silcn:expression;
the node-set resulting from its evaluation is used only for evaluation of its sibling silcn:expression and is limited in scope to the current silcn:set-criterion;
only one probe:for-each should be used per silcn:set-criterion.