[xquery-talk] Error when using predicate after arrow operator

Michael Kay mike at saxonica.com
Thu Apr 13 13:06:58 PDT 2017


The precedence table at

https://www.w3.org/TR/xquery-31/#id-precedence-order

shows that [] has higher precedence than =>

I don't remember the exact details of the deliberations that led to this decision, but I know we looked at a number of examples. One of them was that

-1 => abs()

should mean 

(-1) => abs()

rather than

- (1 => abs())

which was the effect of the original proposal.

Michael Kay
Saxonica


> On 13 Apr 2017, at 20:09, Joe Wicentowski <joewiz at gmail.com> wrote:
> 
> Hi all,
> 
> As I understand the arrow operator
> (https://www.w3.org/TR/xquery-31/#id-arrow-operator), the following
> query:
> 
>  "1.2.3" => tokenize("\.")
> 
> is equivalent to:
> 
>   tokenize("1.2.3", "\.")
> 
> If this is so, then can anyone shed light on why appending a predicate
> to the former would raise an error but not so for the latter?  In
> Saxon, eXist, and BaseX, the following expression:
> 
>  "1.2.3" => tokenize("\.")[. < "3"]
> 
> raises an error like:
> 
>  XPST0003: Unexpected token "[" beyond end of query
> 
> whereas the pre-XQuery 3.1 approach:
> 
>   tokenize("1.2.3", "\.")[. < "3"]
> 
> returns the results I'd expect:
> 
>  ("1", "2")
> 
> Thanks,
> Joe
> _______________________________________________
> talk at x-query.com
> http://x-query.com/mailman/listinfo/talk




More information about the talk mailing list