Re: [xsl] union and difference

Subject: Re: [xsl] union and difference
From: tcn@xxxxxxxxxxxxx (Trevor Nash)
Date: Sun, 13 May 2001 15:39:50 GMT
Hi Dan,

>Finally, I am not sure I agree with another reply with regard
>to merging of text nodes. I beleive the following definition of
>$set1 will in fact have four distinct nodes:
>
>  <xsl:variable name="set1" select="set1/text()"/>
>  <xsl:value-of select="count($set1)"/>
>
>Adjacent text nodes get merged on occassion but perhaps 
>some could clarify precisely when this happens as I am not 
>100% certain.
>

Sorry.
You are right of course - I just checked the spec.  Adjacent text
nodes get merged in result tree fragments, not node sets.  For
example,

<xsl:variable name="set1">
   <xsl:for-each select="set1/text()">
      <xsl:value-of select="."/>
   </xsl:for-each>
</xsl:variable>
<xsl:value-of select="count($set1/text())"/>

might seem a clumsier way of doing the same thing, but in fact gets
you one node not four.  (Only works post XSLT 1.0 too - it converts an
RTF to a node set).

Regards,
Trevor Nash


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread