1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)), "	")