File: Data.xml
0001
name 1
0002
name 2
0003
name 3
File: Query.xquery
let $cat := doc("Data.xml")/order
for $model in distinct-values($cat/car/@model)
return Department: {if ($model = "B")
then "Accessories"
else if ($model = "C")
then "Menswear"
else if ($model = "A")
then "Womens"
else ()
} ({$model})
Output:
Department: Womens (A)
Department: Accessories (B)