Re: [xsl] value-of w/separator and nodes

Subject: Re: [xsl] value-of w/separator and nodes
From: Abel Braaksma <>
Date: Fri, 02 Feb 2007 20:24:03 +0100
Michael Kay wrote:
If you read the rules for value-of, you'll see that adjacent text nodes in
the sequence are concatenated first, before inserting the separator. So if
you have a sequence of text nodes, no separator is inserted. It's important
here to understand the subtle distinction between text nodes and strings.

The difference is necessary to ensure that you get the expected and
traditional result from something like

I must have missed it. I see it now, and it is quite clear indeed, quote: "separators are never inserted between adjacent text nodes." and, in the same example: "the content is supplied as a sequence of five text nodes, which are concatenated without space separation.".

Somehow, I found the following logic logical: take a list of items, each item has a type T. Concatenate all items by casting each type T to a string, append the separator and append to each other.

Instead, there are two rules. If type T is of a non-atomic type, there is no separator at all (I'd prefer the default separator to be the empty string, as is explained for the sequence constructor of the value-of instruction, making it possible to override this behavior, now I must resort to tedious concat()). If type T is of an atomic type, the above rule applies.

The subtleties of the language are what makes a language a language. But the subtleties are often hard to grasp or to sink in.


Current Thread