xsl-list
[Top] [All Lists]

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

2011-05-09 06:00:53
On Mon, May 9, 2011 at 6:48 AM, Christian Rinderknecht
<konchog(_dot_)zangpo(_at_)gmail(_dot_)com> wrote:
Let us say that I have a subtree like

<author>
 <first>Priscilla</first>
 <last>Walmsley</last>
</author>

Using Saxon HE 9-3-0-4j and assuming the current node is the parent of
author, the result of

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

or

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

is the same as

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

that is, 'PriscillaWalmsley'. But

<xsl:value-of select="author/first,author/last"/>

produces

'Priscilla Walmsley'.

Is this the semantics intended?

Yes.  With select="author", the result is a single node, so the
separator isn't used.  Rather, the string value of the node is taken,
which is just the concatenation of the descendant text nodes with no
separators.

The latter example selects the two child nodes of author, so the
separator is put between them.  You could accomplish the same effect
by using select="author/*".

-Brandon :)

--~------------------------------------------------------------------
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>
--~--