<a>
{
for $o in doc("x.xml")/users/org
where fn:count($o/mem)
order by fn:count($o/mem) descending
return <org>
<b> {$o/@name/string()} </b>
<c> {$o/@ab/string()} </c>
<d> {fn:count($o/mem)} </d>
</org>
}
</a>
我已按降序排列结果,但我只需要前 4 个结果。我尝试使用 wiki 页面上的 sub-sequence 方法以及 [position() 1,4] 方法来查找前 4 名,但没有成功。