[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Ramkumar V wrote:
Well if the markup in the input XML is contained in a CDATA section then in the XSLT/XPath data model there is simply a text node as the sole child node of the 'bk:text' element. If you want to use XPath or apply-templates on the XML markup in that text node then you first need to parse the markup as XML (as long as it is XML). However doing so requires an extension function. Saxon 9 has one for such a task
<xsl:template match="bk:text"
<p>
<xsl:apply-templates select="saxon:parse(concat('<dummy>', ., '</dummy>'))/dummy/node()"
xmlns:saxon="http://saxon.sf.net/"/>
</p>
</xsl:template>
--
Re: [xsl] Displaying element value in browser, which is inside CDATA in XML
Subject: Re: [xsl] Displaying element value in browser, which is inside CDATA in XML From: Martin Honnen <Martin.Honnen@xxxxxx> Date: Mon, 18 Jul 2011 14:13:14 +0200 |
Ramkumar V wrote:
I used the same template match, to display anchor attribute('name') value in browser. But I can't.
XSL: ==== <xsl:template match="bk:text"> <p><xsl:value-of select="." disable-output-escaping="yes"/></p> </xsl:template>
<xsl:template match="a"> <xsl:apply-templates/><sup><font color="red"><xsl:value-of select="@name"/></font></sup> </xsl:template>
XML: ==== <?xml version="1.0"?>
<bk:text><![CDATA[Psychologists acknowledge that, as in the heroism of Sully Sullenberger, sometimes an individual’s best moments emerge<a class="page_break" name="page7"></a> amid the most difficult circumstances.]]></bk:text>
Required Browser output: ======================== Psychologists acknowledge that, as in the heroism of Sully Sullenberger, sometimes an individual’s best moments emerge << the text 'page7' will appear superscript and font color :red>> amid the most difficult circumstances
Well if the markup in the input XML is contained in a CDATA section then in the XSLT/XPath data model there is simply a text node as the sole child node of the 'bk:text' element. If you want to use XPath or apply-templates on the XML markup in that text node then you first need to parse the markup as XML (as long as it is XML). However doing so requires an extension function. Saxon 9 has one for such a task
<xsl:template match="bk:text"
<p>
<xsl:apply-templates select="saxon:parse(concat('<dummy>', ., '</dummy>'))/dummy/node()"
xmlns:saxon="http://saxon.sf.net/"/>
</p>
</xsl:template>
--
Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Displaying element value , Ramkumar V | Thread | RE: [xsl] Displaying element value , Liam R E Quin |
Re: FW: [xsl] adjust width of block, Mathis Mörke | Date | RE: [xsl] Displaying element value , Liam R E Quin |
Month |