[xquery-talk] if statements within where clauses?

Cindy Girard clm6u at virginia.edu
Wed Jun 14 16:35:43 PDT 2006


PERFETTO!

Thanks, Jonathan!

JR> Use parentheses around the ifs. Here's an expression that works:

JR> declare variable $doc := document{ 
JR> <tei.2><article><author><first>Cindy</first></author></article></tei.2> };

JR> for $a in $doc//author
JR> where (if ($a/first)
JR>          then $a/first eq 'Cindy'
JR>          else true())
JR>   and (if ($a/last)
JR>          then $a/last eq 'Girard'
JR>          else true())
JR> return $a

JR> Does that help?

JR> Jonathan

JR> P.S., of course my example isn't valid TEI ;->




-- 
- Cindy 



More information about the talk mailing list