File: Data.xml
0001
name 1
0002
name 2
0003
name 3
File: Query.xquery
declare boundary-space preserve;
declare namespace prod = "http://rntsoft.com/prod";
declare variable $order := doc("Data.xml")//order;
{count($order/car)} ,
{$order/car/id}
Output:
3
0001
0002
0003