[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: xsl-list Digest 28 May 2008 05:10:01 -0000 Iss

Subject: RE: Re: xsl-list Digest 28 May 2008 05:10:01 -0000 Issue 1511
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 29 May 2008 12:30:11 +0100
RE:  Re: xsl-list Digest 28 May 2008 05:10:01 -0000 Iss
> Equally adjacent text nodes are merged, so nested value-of's 
> are pointless:
> 
> <xsl:value-of separator="xx">
>   <xsl:value-of select="/root/node[1]"/>
>   <xsl:value-of select="/root/node[2]"/> </xsl:value-of>
> 
> ...here the output is "foobar" as "foo" and "bar" are merged 
> before the outer value-of gets to them.

No, that's not quite true. If you do this:

<xsl:function name="f" as="xs:string">
    <xsl:value-of select="$g/root/node[1]"/>
    <xsl:value-of select="$g/root/node[2]"/>
</xsl:function>

you will get a type error because the function is returning two text nodes,
and you can't convert two text nodes to a string. Change it to this:

<xsl:function name="f" as="xs:string">
  <xsl:value-of>
    <xsl:value-of select="$g/root/node[1]"/>
    <xsl:value-of select="$g/root/node[2]"/>
  </xsl:value-of>
</xsl:function>

and it works, because you can convert one text node to a string.

Adjacent text nodes are merged only by an operation that merges them, for
example <xsl:element> or <xsl:value-of>.

Michael Kay
http://www.saxonica.com/

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.