[xquery-talk] Whitespace problem in CSV-like output

Andrew Welch andrew.j.welch at gmail.com
Mon Oct 20 12:28:24 PDT 2008

> Trying to understand why it is working (it does, tested it with Saxon):
> Appending the line feed as a text node seems to influence on the
> interpretation of the other items returned that are now seen as text nodes,
> too, (and thus serialized as immediately adjacent strings) rather than as
> strings that need to be separated with spaces.

Adjacent text nodes are merged into a single text node... so a
sequence of text nodes becomes a single text node, requiring no

For example:

"//text()" will ultimately return a single text node

"for $x in //text() return xs:string($x)" will return sequence of
strings separated by a space (provided count($x) > 1)

Andrew Welch
Kernow: http://kernowforsaxon.sf.net/

More information about the talk mailing list