I have XML file:
...
<Chart id="c01">
<expires>2012-07-19 12:20:00</expires>
<data><![CDATA[...]]></data>
</Chart>
...
where CDATA is B64 encoded PNG image, and whanted to transform XML to HTML to view the image.
For that purpose I set XSL to output text and dump CDATA:
<xsl:output method="text"/>
<xsl:template match="//data/text()">
<xsl:value-of select="."/>
</xsl:template>
In the same template I wrap basic HTML structure, which I excluded here for clearance.
The problem is this: If I use XPath on XML file //data/text() I get just CDATA text, but with above XSL I get also “2012-07-19 12:20:00” from <expires> XML element, in the output.
I guess it’s some basic thing I’m missing, but why is date also outputed and how can I avoid it in output?
Probably the shortest way to achieve this is:
The complete transformation:
When this transformation is applied on the XML document:
the wanted, correct result is produced: