The problem in your code is that you post a sequence into the newly constructed element, which gets serialized with spaces in between. Explicitly use string-join
here:
<services>{
string-join(
(: all the other code for modification :),
'' (: Nothing between the individual strings :)
)
}</services>
Anyway, I'm not sure where your call on tokenize
and $bitmap
are connected.
For converting an array to a sequence, adjusting some values and returning the string again, use string-to-codepoints
respective the reverse function. It returns unicode codepoints, to change from 0 to 1 just add 1. An example:
let $bitmask := '00000000000000000000000000000000'
return
codepoints-to-string(
for $char at $i in string-to-codepoints($bitmask)
return
if ($i = (3,10))
then $char + 1
else $char
)