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