This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
It would be nice to have an example for this commonly used kind of filter expression : $foo[(2 to 5)] New users often tend to use a predicate-like syntax - $foo[2 to 5] - and thus get syntax errors. It would also be nice to add a reference to "Filter expressions" (3.3.2) in the "Predicates" section (3.2.2). I don't know whether it should start with "warning", "see also", "do no confuse"...
$foo[(2 to 5)] is not a legal expression. It will give you a type error FORG0006: se the rules for effective boolean value at http://www.w3.org/TR/xpath20/#id-ebv, which are referred to from the rules for predicates at http://www.w3.org/TR/xpath20/#id-predicates There was an example of such a construct in a very early draft of XQuery back in 2001, but it never had any defined semantics. You can achieve the desired effect by writing $foo[position()=(2 to 5)] or if you prefer, by subsequence($foo, 2, 4) Michael Kay (personal response)
Clean and clear answer. I thus reformulate : may the first example provided by Michael be added to the specs ? The comment about cross-referencing predicates and filter expressions still stands although I now lean more an more towards "warning" semantics :-)
Pierrick, On 14 March 2006, the Query Working Group agreed to add the requested example to the explanation of predicates. Since this is an editorial suggestion that was accepted by the working group, I am marking this Bugzilla entry as Closed. Regards, Don Chamberlin (for the Query Working Group)