【发布时间】:2014-06-09 15:12:05
【问题描述】:
在我的 xml 文件中
<a>
<test id="bk1">
<go>B</go>
<from>A</from>
<test/>
<test id="bk2">
<go>C</go>
<from>D</from>
<test/>
<test id="bk2">
<go>D</go>
<from>E</from>
<test/>
</a>
所以我想选择 go 和 from 值并创建一个元素调用 $elements
预期输出:
<city>A</city>
<city>B</city>
<city>C</city>
<city>D</city>
<city>E</city>
在我的 xquery 查询中:
for $a in /a/test
for $elements in distinct-values($go) //How to add from into elements ?
return
<city>
{$elements}
</city>
【问题讨论】: