I am struggling with a strange issue which I guess I am unable to pinpoint. here with below piece of code, I am trying to see if value of $DeliveryZone is <=8 then simple assign to tag
else I am matching this value from a variable $SiteInfo which is a loop containes values like
<v3:SiteInfo>
<v3:Site>
<v3:SiteId>
<v3:AlternativeCodeVal>01122JGVL9NBB</v3:AlternativeCodeVal>
</v3:SiteId>
<v3:SiteCode>
<v3:AlternativeCodeVal>EABLRXX</v3:AlternativeCodeVal>
now the main problem is, if value matches below 8 char then I am fine else say in SiteInfo, I have 4 entry, then below loop goes for 4 time and if value matches it display. But same it does display 3 empty tags. help me with this
<ns0:PlaceZone>
{
let $DeliveryZone := $getRevenueRequest1/ns0:Product/ns0:PlaceofDeliveryZone/ns0:AlternativeCode/ns0:AlternativeCodeVal/text()
return
if(fn:string-length($DeliveryZone) <= 8) then
<ns0:AlternativeCode>
<ns0:AlternativeCodeVal>{$DeliveryZone}</ns0:AlternativeCodeVal>
</ns0:AlternativeCode>
else
for $SiteInfo in $getSiteInfoByIdRes1/ns1:SiteInfo
return
let $DeliveryZone1 := $SiteInfo/*:Site[*:SiteId/*:AlternativeCodeVal = $PlaceofDeliveryZone]/*:SiteCode/*:AlternativeCodeVal/text()
return
if(fn:string-length($DeliveryZone1) <= 8) then
<ns0:AlternativeCode>
<ns0:AlternativeCodeVal>{$DeliveryZone1}</ns0:AlternativeCodeVal>
</ns0:AlternativeCode>
else ()
}
Aucun commentaire:
Enregistrer un commentaire