File: Data.xml
<order>
<car model="A">
<name language="en">name 1</name>
</car>
<car model="B">
<name language="en">name 2</name>
</car>
<car model="B">
<name language="en">name 3</name>
</car>
</order>
File: Query.xquery
for $prod in doc("Data.xml")/order/car
where $prod/@model = "B"
order by $prod/name
return $prod/name
Output:
<?xml version="1.0" encoding="UTF-8"?>
<name language="en">name 2</name>
<name language="en">name 3</name>
|