File: Data.xml
<prices>
<priceList>
<prod>
<price>29.99</price>
</prod>
<prod>
<price>69.99</price>
</prod>
</priceList>
</prices>
File: Query.xquery
if (doc("Data.xml")/prices/priceList/prod[price < 30])
then <bin>{
doc("Data.xml")/*/priceList/prod[price < 30]
}</bin>
else ()
Output:
<?xml version="1.0" encoding="UTF-8"?>
<bin>
<prod>
<price>29.99</price>
</prod>
</bin>
|