File: Data.xml
0001
name 1
0002
name 2
0003
name 3
File: Query.xquery
for $prod in (doc("Data.xml")/order/car)
return if ($prod/@model = 'ACC')
then {data($prod/id)}
else if ($prod/@model = 'WMN')
then {data($prod/id)}
else if ($prod/@model = 'MEN')
then {data($prod/id)}
else {data($prod/id)}
Output:
0001
0002
0003