Just to be clear:
Is item-separator set as the empty string or is it not set at all for
the cases where you don't get the result you expect?
My tests with (the lastest) Saxon HE 12.4:
declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'text';
let $xml:=<xml><element>text1</element><element>text2</element></xml>
return $xml/element/text()
gives
text1text2
while
declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'text';
let $xml:=<xml><element>text1</element><element>text2</element></xml>
return $xml/element/string()
gives
text1 text2
On the other hand
declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'text';
declare option output:item-separator '';
let $xml:=<xml><element>text1</element><element>text2</element></xml>
return $xml/element/text()
gives
text1text2
as does
declare namespace output =
"http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'text';
declare option output:item-separator '';
let $xml:=<xml><element>text1</element><element>text2</element></xml>
return $xml/element/string()
I see that as correct reading
https://www.w3.org/TR/xslt-xquery-serialization-31/#serdm, in particular
points 3, 4, 5, 6 of the steps in computing a normalized sequence.
On 27/02/2024 22:01, Leo Studer wrote:
Thanks Hans-Jürgen
Indeed, with BaseX I get the same output for text nodes and strings.
This is also how I understand the serialisation definition. Eventually
Saxonica has another take on this???
Warmest,
Leo
On 27 Feb 2024, at 12:16, Hans-Juergen Rennau <hren...@yahoo.de> wrote:
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.stu...@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