declare variable $count as xs:integer := 0; for $art in collection("TALISMANE-2XML-651865.xml") for $elt in $art//item let $conc2 := if (($elt/a[4]/text()="NC") and ($elt/following-sibling::item[1]/a[4]/text()="P") and ($elt/following-sibling::item[2]/a[4]/text()="NC") and ($elt/following-sibling::item[3]/a[4]/text()="P") and ($elt/following-sibling::item[4]/a[4]/text()="NC")) then ( concat("NOM PREP NOM PREP NOM: ", $elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()," ",$elt/following-sibling::item[3]/a[2]/text()," ",$elt/following-sibling::item[4]/a[2]/text()) ) else if (($elt/a[4]/text()="NC") and ($elt/following-sibling::item[1]/a[4]/text()="ADJ")) then ( concat("NOM ADJ: ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()) ) else if (($elt/a[4]/text()="ADJ") and ($elt/following-sibling::item[1]/a[4]/text()="NC")) then ( concat("ADJ NOM: ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()) ) else if (($elt/a[4]/text()="V") and ($elt/following-sibling::item[1]/a[4]/text()="DET") and ($elt/following-sibling::item[2]/a[4]/text()="NC")) then ( concat("V DET NOM: ",$elt/a[2]/text()," ",$elt/following-sibling::item[1]/a[2]/text()," ",$elt/following-sibling::item[2]/a[2]/text()) ) else ( " " ) where $conc2 != " " group by $g:= $conc2 order by count($conc2) descending return string-join(($g,count($conc2)), " ")