"Where" with multiple values

Hi all.

Suppose the next XML document

<doc>
  <elem>
      <dat>3</dat>
      <dat>2</dat>
  </element>
</doc>

and let study the next query

FOR $v in //elem
WHERE $v/dat < 5
RETURNS $v

My problem is the valuation of the WHERE part of the query expression.  In 
the XQuery recommendation:

"Only those tuples for which the condition in the WHERE-clause is true are 
used to invoke the RETURN clause. The WHERE-clause may contain several 
predicates, connected by AND and OR. "

So, the expression in the WHERE clause have to be evaluable as a boolean. But 
in my example, $v/dat evaluate as a sequence (doesn't it?), and the operator 
< evaluate for each member of that sequence. So I have a sequence of boolean 
values. 

Then, I think that this expression will make a mistake, because it evaluate 
to a sequence of size > 1, and not to a boolean value (or a sequence of size 
1 of boolean values :-), and it don't care if all the values in the sequence 
are true.

Am I wrong?

Thank you, and excuse my English.


José María Sánchez  Sáez  (:-)
jmss@gssi.es 
Málaga (Spain)

Received on Tuesday, 18 December 2001 05:19:10 UTC