例如,我需要我的结果是形式
<result>
<French>
<country>country-name</country>
<country>country-name</country>
...
</French>
<German>
<country>country-name</country>
<country>country-name</country>
...
</German>
</result>
但目前,我的结果是形式
<language percentage="100">German</language>
<language percentage="32">French</language>
<language percentage="1">German</language>
<language percentage="100">French</language>
<language percentage="100">French</language>
<language percentage="100">German</language>
<language percentage="99">French</language>
<language percentage="100">French</language>
<language percentage="10">French</language>
<language percentage="32">German</language>
<language percentage="100">French</language>
<language percentage="18">French</language>
<language percentage="65">German</language>
这是我的查询:
doc("countries.xml")//country/language[contains(text(), "French") or contains(text(), "German")]
原始数据如下所示:
<country name="Afghanistan" population="22664136" area="647500">
<language percentage="11">Turkic</language>
<language percentage="35">Pashtu</language>
<language percentage="50">Afghan Persian</language>
</country>