for $item in collection("total-udpipe.xml")//item where contains($item/a[8]/text(), 'obj') let $formedependant:=$item/a[2]/text() let $positiondependant:=$item/a[1]/text() let $positiongouverneur:=$item/a[7]/text() let $relation:= if ($positiongouverneur > $positiondependant) then ( concat($formedependant,"/DEP ",$item/following-sibling::item[a[1]=$positiongouverneur]/a[2]/text(),"/GOV") ) else ( concat($item/preceding-sibling::item[a[1]=$positiongouverneur]/a[2]/text(),"/GOV ",$formedependant," /DEP ")) return $relation