This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getting text nodes of subtree?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]