File: Data.xml
0001
name 1
0002
name 2
0003
name 3
0004
name 4
File: Query.xquery
for $prod in doc("Data.xml")//car
order by $prod/id
return {string($prod/name)}
Output:
name 1
name 2
name 3
name 4