File: Data.xml
0001
name 1
navy black
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)} ,
{data($prod/name)} )
else {data($prod/id)}
Output:
0001
name 1
0002
0003