1.

How To Perform Conditional Operations In Xquery?

Answer»

Conditional operation in XQuery is If-Then-Else operation. Let?s take an EXAMPLE to see how to use it:

Example:

for $a in doc("bookmart.xml")/bookstore/book
RETURN if ($a/@category="ADVENTURE")
then &LT;child>{DATA($a/title)}</child>
else <ADULT>{data($a/title)}</adult> 

Conditional operation in XQuery is If-Then-Else operation. Let?s take an example to see how to use it:

Example:

for $a in doc("bookmart.xml")/bookstore/book
return if ($a/@category="ADVENTURE")
then <child>{data($a/title)}</child>
else <adult>{data($a/title)}</adult> 



Discussion

No Comment Found