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