我的 XQuery 是:
declare namespace xsd="http://www.w3.org/2001/XMLSchema";
for $schema in xsd:schema
for $nodes in $schema//*,
$attr in $nodes/xsd:element/@name
where fn:contains($attr,'city')
return $attr
返回: name="city" name="city" name="city" name="city" name="city"
当我添加不同的值时:
declare namespace xsd="http://www.w3.org/2001/XMLSchema";
for $schema in xsd:schema
for $nodes in $schema//*,
$attr in $nodes/xsd:element/@name
where fn:contains($attr,'city')
return distinct-values($attr)
返回:city city city city city
我只需要一个“城市”,我该怎么做?