xsl-list
[Top] [All Lists]

RE: accessing CDATA from XSL

2002-12-23 14:57:14
Conal Tuohy wrote:
<xsl:value-of select="text()"/> will return the text of the
parent element, without including the text of the <child>
element.

The select identifies the node-set consisting of those text
nodes, yes, but using value-of on a node-set will result in
the use of the string-value of just the first node in the
set.

Yes I tend to forget the implicit "[1]" in <xsl:value-of>.

It seemed to me that Mukund's original example was contrived (e.g. a child
called "child") and I was trying to propose a general solution for what I
was guessing Mukund might want to do (possibly multiple children, for
instance). I guess what I was really trying to say was something like:

<xsl:for-each select="text()"><xsl:value-of select="."/></xsl:for-each>

or even

<xsl:for-each select="text()[normalize-space(.)]"><xsl:value-of
select="."/></xsl:for-each>

But actually I think the real answer Mukund was looking for was that the
CDATA section AS SUCH is not accessible in XSLT ... it's just merged with
other text data.

Cheers!

Con


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



<Prev in Thread] Current Thread [Next in Thread>