arr=123 123 arr.123 xquery version '3.0'; let $context := doc($db:context) let $howmany := 1000 let $lemmata := $context//lemma[(geo//arr/@ref = 'arr.123')] return <result lem='{count($lemmata)}' atts='{count($lemmata/following-sibling::att)}' shown='{$howmany}'> { for $i in 1 to min(($howmany, count($lemmata))) let $lem := $lemmata[$i] order by $lem/vorm return <entry> {$lem} {$lem/following-sibling::att} </entry> } </result> Baden-Baden Baden-Baden Baden 1224 Kb 133/5 a Freiburg im Breisgau Freiburg im Breisgau Friburc ± (1135-80) K Schr GL Konstanz Konstanz Constantia 1104 Tr J 1 Nellenburg Hindelwangen Nellenburc 1065 Kb 33/1 Pfullendorf Pfullendorf Phulendorph 1174 K D 27 Phvllindorp 1174 D S 54 Reichenau Reichenau Augiensis 1113 P L 9267/4 Üsenberg Wüstung bei Breisach Vsenberc 1171 Kb 1 A 76