Wrapping results in a new element
File: Data.xml <order> <car model="ACC"> <id>0001</id> <name language="en">name 1</name> </car> <car model="BCC"> <id>0002</id> <name language="en">name 2</name> </car> <car model="BCC"> <id>0003</id> <name language="en">name 3</name> </car> </order> File: Query.xquery <ul>{ for $car in doc("Data.xml")/order/car where $car/@model='ACC' order by $car/name return $car/name }</ul> Output: <?xml version="1.0" encoding="UTF-8"?> <ul> <name language="en">name 1</name> </ul>