Re: [xsl] Attribute "separator" of xsl:value-of in XSLT 2.0

Subject: Re: [xsl] Attribute "separator" of xsl:value-of in XSLT 2.0
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Mon, 9 May 2011 12:10:38 +0100
> <author>
>  <first>Priscilla</first>
>  <last>Walmsley</last>
> </author>

> <xsl:value-of select="author" separator=" "/>

Here you select a sequence of one item, so there is nothing to join.

> <xsl:value-of select="author/first,author/last"/>
>
> produces
>
> 'Priscilla Walmsley'.

Here you select a sequence of 2 items, which are joined using the
default separator of a space.

The reason is xsl:value-of only ever adds a single text node to the
result tree, but its select attribute can return a sequence of
multiple items, so the separator is used to join the string value of
the items into a single string (just like string-join())

--
Andrew Welch
http://andrewjwelch.com

Current Thread