XML 文件
<Cities>
<Place>
<City n="New Delhi"></City>
<City n="Chandigarh"></City>
<City n="Mumbai"></City>
</Place>
<Place>
<City n="New Delhi"></City>
<City n="Chandigarh"></City>
</Place>
<Place>
<City n="New Delhi"></City>
<City n="Mumbai"></City>
</Place>
</Cities>
我正在使用以下 XQuery -
for $x in doc("sample")/Cities/Place/City
order by $x/@n
return distinct-values($x/@n)
我期待的结果是——
Chandigarh Mumbai New Delhi
但得到 -
Chandigarh Chandigarh Mumbai Mumbai New Delhi New Delhi New Delhi
请告诉我我哪里出错了?