Dear Leo,

it is important to remember that serialization - the transformation of the logical query result, which is an XDM value, into a sequence of octets - is defined by a W3C spec [1], and this definition is extremely detailed and precise.

The item separator parameter is applied when concatenating strings. It is not applied when concatenating text nodes, the contents of which are concatenated without any separator. In one case of your example the logical query result is a sequence of text nodes, in the other case it is a sequence of strings. By the way, extreme standard conformance is a hallmark of BaseX.

Kind regards,
Hans-Jürgen

[1]  https://www.w3.org/TR/xslt-xquery-serialization-31/

Am Dienstag, 27. Februar 2024 um 12:03:55 MEZ hat Leo Studer <leo.studer@varioweb.ch> Folgendes geschrieben:


Hello

I am serialising the following expressions on oxygen/saxonEE12.3 as text (item-separator=“”) and wonder why the differente outputs

let $xml:=<xml><element>text1</element><element>text2</element></xml> return $xml/element/text()


gives

text1text2


And

let $xml:=<xml><element>text1</element><element>text2</element></xml> return $xml/element/string()


text1 text2



When I set the item-separator =“, “ then I get 

text1, text2


Or

text1, , text2



Any explanations???

Thanks,
Leo