Subject: Re: [xsl] accessing CDATA from XSL From: Mike Brown <mike@xxxxxxxx> Date: Mon, 23 Dec 2002 00:26:15 -0700 (MST) |
Sai, Mukundan (IE10) wrote: > I have an xml file which has got a CDATA in it for eg: > <parent> > <child>.... </child> > < ! [ CDATA[ hi how r u .....]]> > </parent> > > so from my xsl i want to access the content of the CDATA > ie .. i how do i do that ie > <xsl:template match="Parent"> > <xsl:value-of select="."/> > i want the CDATA value here > so how do i do that > mukund <xsl:value-of select="child/following-sibling::text()"/> Note that the whitespace is character data too, and the fact that some of the character data is in is a CDATA section goes away when the XML is parsed. The XPath tree looks like: element 'parent' | |___text '\n' | |___element 'child' | | | |___text '.... ' | |___text '\n hi how r u .....\n' If you were to do xsl:value-of select="text()" you'd only get the first text node child of 'parent', so that's why I suggest you look for the first text node that's a following sibling of 'child'. Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] accessing CDATA from XSL, Conal Tuohy | Thread | RE: [xsl] accessing CDATA from XSL, Jarno . Elovirta |
RE: [xsl] accessing CDATA from XSL, Conal Tuohy | Date | RE: [xsl] accessing CDATA from XSL, Jarno . Elovirta |
Month |