[xquery-talk] where clause

Michael Sokolov msokolov at safaribooksonline.com
Thu Mar 28 10:15:20 PST 2013


On 03/28/2013 12:23 PM, daniela florescu wrote:
> Michael,
>
> in addition to the queries I already gave you with count and groupby, here is another one in
> pure XQuery  1.0  that cannot be reduced
>
> declare function foo($x)
> {
>      if ($x/@a) then $x else<b/>
> };
>
>
> for $x in Blah1
> for $y in Blah2
> let $z := foo($y)
> where $z is $z
> return $x
>
>
> (variable $z cannot be unfolded because of the generation of new nodes, and then the where cannot be move up because
> of the let)
>
>
> Sorry, I felt like being twisted minded this morning :-)
>
> XQuery is wicked :-)
>    
Yes, that is twisted for sure.  But isn't it also equivalent to:

for $x in Blah1
for $y in Blah2
for $z in foo($y)[. is .]
return $x

?

not that that really makes any difference, in some sense, but given the 
problem as stated, I don't think a where clause is required

-- 
Michael Sokolov
Senior Architect
Safari Books Online



More information about the talk mailing list