xsl-list
[Top] [All Lists]

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

2011-05-09 06:10:47
<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

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--