Reputation: 1729
I have an XML, part of it which I want to query is:
<c14>06</c14>
<c14 m='1' s='2'>01</c14>
<c14 m='2'>01</c14>
Is the following XPATH predicate correct to query the elements other than m='2'
ones?
( some $t in c14[not(@m) or @m=1]/text() satisfies fn:number($t) =01)
It gives correct result, but I am not sure how, because that or
in the predicate would have returned two nodes - not(@m) and @m=1
. How did it apply text()
on that?
Thanks
Upvotes: 1
Views: 737
Reputation: 60424
The text()
node test is performed once for each item selected by the previous step -- c14[not(@m) or @m=1]
.
See this section of the spec (italics mine):
Certain language constructs, notably the path expression E1/E2 and the predicate E1[E2], create a new focus for the evaluation of a sub-expression. In these constructs, E2 is evaluated once for each item in the sequence that results from evaluating E1. Each time E2 is evaluated, it is evaluated with a different focus.
Upvotes: 2