Reputation: 147
I have following:
<xsl:for-each select="/ROOT_NODE/NODE_1/NODE_11/LOCALE[CO >= 8] |
NODE_2/NODE_22/OCA">
</xsl:for-each>
two questions:
<xsl:for-each>
?Upvotes: 1
Views: 2114
Reputation: 338288
The context node in the XPath is
/
)In your case the context for the second part of the XPath union would be the node that was current before the <xsl:for-each>
.
Within the for-each, the context node switches to each node that is being iterated over.
For the result of an XPath union, document order is relevant. If /ROOT_NODE/NODE_1/NODE_11/LOCALE[CO >= 8]
comes before NODE_2/NODE_22/OCA
in the document, then the first part will be processed first, else the other way around.
In general it is not a good idea to rely on this side effect, though. You should declare sort order (<xsl:sort>
), or not iterate over a union of different things (use two consecutive <xsl:for-each>
loops to make output order fixed and apparent).
Upvotes: 6