I'm trying to replace a 32 bit string variable. At first, all values "0".
$bitmask:="00000000000000000000000000000000"
I have some index values and should replace the values in these indexes with "1".
For instance, I have index values=(3,10)
expected result should be;
$bitmask:="00100000010000000000000000000000"
Actually I did it :) but there is space characters in my bitmask values. I couldn't remove the space characters.
My working code;
$serviceBits := tokenize('0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0',',')
<services>
{
for $t at $pos in $serviceBits
let $temp := ''
return
if($pos = data($myElement/ns:position)) then
concat($temp, '1')
else
replace(concat($temp, $t)," ","")
}
</services>
And the result of my working code is;
<services>0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0</services>