declare function local:getOthers($item) {
let $nextItem := $item/following-sibling::*[./TECH_Code_Ligne/text()="0012"][1]
for $related in $item/following-sibling::*[./TECH_Code_Ligne/text()!="0012"]
where if($nextItem) then $related << $nextItem else true()
return $related
};
{
for $r0012 in /root/row
where $r0012/TECH_Code_Ligne/text()="0012"
return
{$r0012/*}
{
for $r0022 in local:getOthers($r0012)
where $r0022/TECH_Code_Ligne/text()="0022"
return
{$r0022/GENE_Montant_1}
{$r0022/GENE_Montant_2}
{$r0022/GENE_Montant_3}
{$r0022/GENE_Montant_4}
{$r0022/GENE_Date_1}
{$r0022/GENE_Date_2}
{$r0022/GENE_Taux_1}
{$r0022/GENE_Taux_2}
}
{
for $rOther in local:getOthers($r0012)
where $rOther/TECH_Code_Ligne/text()!="0012" and $rOther/TECH_Code_Ligne/text()!="0022"
return
{$rOther/GENE_Montant_1}
{$rOther/GENE_Montant_2}
{$rOther/GENE_Montant_3}
{$rOther/GENE_Montant_4}
{$rOther/GENE_Date_1}
{$rOther/GENE_Date_2}
{$rOther/GENE_Taux_1}
{$rOther/GENE_Taux_2}
}
}
(: Stylus Studio meta-information - (c) 2004-2009. Progress Software Corporation. All rights reserved.
:)