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: Brandon Ibach <brandon.ibach@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 9 May 2011 07:00:42 -0400
On Mon, May 9, 2011 at 6:48 AM, Christian Rinderknecht
<konchog.zangpo@xxxxxxxxx> 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 :)

Current Thread