[xquery-talk] where clause

Michael Kay mike at saxonica.com
Wed Mar 27 14:43:28 PST 2013

On 27/03/2013 12:31, Michael Sokolov wrote:
> I'm trying to come up with examples in which "where" clauses cannot be 
> rewritten as XPath predicates.  So far, the ones I have all involve an 
> "at" counter.  Are there others?
The ones that are trickiest to rewrite are those that reference the 
context. For example

$y/(for $x in //item where $x/@status = . return $x)

To translate this into a predicate you need to introduce a variable:

$y/(let $z := . return //item[@status = $z])

Michael Kay

More information about the talk mailing list