(:
Hello I have a hopefully not too silly question ...
Is there an easy way to remove the exponent notation and return 30000201_30000000
without working out where the E is in the parts and padding zeros
====> <a>
<d>3.0000201E7_3.0E7</d>
</a>
:)
declare function local:sumVec($a,$opt){
let $a := <x>{for $w at $pos in $a
return
for $v at $pos in tokenize(xs:string($w),"_")
return element {'a'} { (attribute {'pos'} {$pos}, try {xs:float($v)} catch * {0} )}
}</x>
let $b := string-join(for $w in distinct-values($a//@pos)
return if ($opt=0) then sum($a/a[@pos=$w]) ,"_")
return $b
};
let $a := ''
return <a>
<d>{local:sumVec(('10000001_10000000','10000000_10000000','10000000_10000000','100_',100),0)}</d>
</a>