Confusing syntax error

Hello,

If have some xml instances of the following form
stored in Tamino:


Left and leaving
The Weakerthans


The following Xquery works as expected:

for $s in input()/song
where $s/title = “The Weakerthans”
return $s

In this one I have ony changed the node for comparison in the where part from “title” to “by” and the xquery fails with a syntax error in line 2:

for $s in input()/song
where $s/by = “The Weakerthans”
return $s

I suspect that the xquery parser thinks that by is
part of a function e.g. “sort by” and therefore throws
a syntax error, or did I miss something essential here?

Thank you very much,

Ben

Hi Ben,

you are right, ‘by’ is taken as an XQuery keyword, try

for $s in input()/song
where $s/:by = "The Weakerthans"
return $s

regards,
Juliane.

Hi Juliane,

That’s what I was looking for!
Thank you very much,

Ben