for $item in collection("udpipe-3208.txt.xml")//item where contains ($item/a[8]/text(),'obj') let $det := $item/a[2] let $positiongouv := $item/a[7] let $gouv := if ($positiongouv > number($item/a[1])) then($item/following-sibling::item[a[1]=$positiongouv]/a[2]) else($item/preceding-sibling::item[a[1]=$positiongouv]/a[2]) let $preresu:= string-join(($gouv,$det)," ") group by $g:=$preresu order by count($preresu) descending return string-join(($g,count($preresu))," ")