value-of misses children 2003-02-27 - By Mike.J.Bresnahan@(protected)
> I'm trying to select all the text of a set of nodes, but > it fails. What am I doing wrong here? > When I use: <xsl:value-of select="alpha/beta"/> > it only includes the FIRST beta under alpha, > not all betas under alpha.
I believe the following facts are true:
- alpha's value is a node set - each alpha/beta's value is a single text node - xsl:value-of returns the value of a single node, not the value of a node set. I.e. it selects and returns the value of the first node matching the XPath query.
Therefore:
- <xsl:value-of select="alpha"> returns the value of the single <alpha> node; which is a node set containing 3 nodes. - <xsl:value-of select="alpha/beta"> returns the value of the first <beta> node under the <alpha> node; which is a text node.
To get what you want, you need to do the following:
<xsl:for-each select="alpha/beta"> <xsl:value-of select="."/> </xsl:for-each>
Mike Bresnahan
|
|