This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
For my understanding the spec don't clearly specify how predicates of a predicate list are evaluated. What we have is: 3.2.1 "The value of the step consists of those items that satisfy the predicates." So i see two possibilities (C be the set of context nodes of a step without applied predicates): 1) each predicate is applied to C and the intersection of these results will be the result of the step 2) the predicates are applied left to right and the result of one predicate evaluation is the context for the following predicate Both possibilities are equal as long as no positional filter (position(), first(), last(), numeric item) is used. The only indication that case 2 is the right one is given in 3.2.4 with the examples para[@type="warning"][5] and para[5][@type="warning"] Furthermore 2.3.4 states "An implementation is permitted, however, to reorder the predicates to achieve better performance...". This however could be misleading interpreted as supporting case 1. Therefore I would propose to clearly state how predicate lists are to be evaluated and give a warning/hint in 2.3.4 that reordering of predicates is dangerous if predicates with references to context positions are included. Kind regards Timo
Hi Timo, Isn't the intent clear from the text "A step is a part of a path expression that generates a sequence of items and then filters the sequence by zero or more predicates"?
Hi Jonathan, No. This sentence only states (in my understanding) that predicates are applied after evaluating axis and node test. But how they are applied (if we have more than one) is not explicitly specified. If we have /n[pa][pb] according to my description case 1) evaluate /n[pa] and /n[pb]; the result is the intersection of both case 2) evaluate /n[pa] = C1 and afterwards C1[pb] = result I can't find a clear statement in the recommendation which tells that case 2 is the right one (see also my comment regarding 2.3.4)
Timo, Thanks for your comment. The Query and XSLT working groups considered your comment at their meeting on 02 Feb 2006, and agreed that it would be helpful to add text clarifying that predicates are effectively applied from left to right. This text will be added to the next published version of the XPath and XQuery specifications. Since we consider this to be an editorial rather than a substantive revision, I have marked this comment as closed. When you see the revised documents, please feel free to submit a new comment if you feel the issue has not been adequately dealt with. Regards, Don Chamberlin, for the Query and XSLT working groups