[xquery-talk] variable references in location steps

Andrew Welch andrew.j.welch at gmail.com
Fri Feb 25 11:25:29 PST 2011


> let $test :=
> <test>
>  <a><el>match1</el></a>
>  <a><el>match2</el></a>
>  <b><el>match2</el></b>
> </test>
> let $match2 := $test/el[matches(., 'match2')]
> return $test/a[./$match2]

I'm guessing there's a reason why you can't just do:

$test/a[el = 'match2']

and that you need to use matches() for the value compare, otherwise
that will slow things right down...

For the 2 step route, you could do:

$test/a[exists(el intersect $match2)]

..which might be worth doing if $match2 takes a lot to create.


-- 
Andrew Welch
http://andrewjwelch.com



More information about the talk mailing list