This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: union and difference
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] union and difference
- From: tcn at melvaig dot co dot uk (Trevor Nash)
- Date: Sun, 13 May 2001 15:39:50 GMT
- Organization: Melvaig Software Engineering Limited
- References: <20010513131725.77168.qmail@web12608.mail.yahoo.com>
- Reply-To: xsl-list at lists dot mulberrytech dot com
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