Re: [xsl] getting text nodes of subtree?

Subject: Re: [xsl] getting text nodes of subtree?
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Fri, 28 Jun 2002 12:28:55 +0100
Hi Jarkko,

> This one nearly does it.
[snip]
> <xsl:value-of select = "//a" >
> <xsl:value-of select = "text()" /> 
> </xsl:value-of>
> 
> <xsl:value-of select = "a/child::*"> 
> <xsl:value-of select = "text()" /> 
> </xsl:value-of>
> 
> <xsl:value-of select = "b/child::*"> 
> <xsl:value-of select = "text()" /> 
> </xsl:value-of>

Really? It should give you an error -- you're not allowed to have
xsl:value-of elements inside other xsl:value-of elements. Perhaps
you're using xsl:for-each instead? In that case, you'd get the value
of the first text node child of each of the a elements in the
document, followed by the first text node child of each of the
elements that are children of the 'a' document element, followed by
the first text node child of each of the elements that are children of
the 'b' document element. (The reason you get only the *first* text
node child of the element is that xsl:value-of picks the first node
from the node set you select with its select attribute, and gives the
string value of that.)

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


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


Current Thread