File: Data.xml
1
name 1
2
name 2
3
name 3
4
name 4
File: Query.xquery
for $prod in doc("Data.xml")//car
where $prod/@dept = "B"
order by $prod/name
return $prod/name
Output:
name 2
name 3