I have the following Xquery:
let $x := <a>
<i>false</i>
</a>
return
if (every $t in $x/a satisfies $t/i eq "true")
then $x
else <nothing/>
How I interpret this is, return $x if all <a> have an <i> that has the word "true". However, this always return $x.
In contrast, if I have the following XML doc:
<root>
<a><i>false</i></a>
</root>
and the following query:
for $x in /root
return
if (every $t in $x/a satisfies $t/i eq "true" )
then $x
else <nothing/>
It will return <nothing/> when <i> contains false and will return $x when <i> is "true"
My questions are:
- Why does the query with "let" behave the way it does?
- Why does the query with "for" behave differently?