Detecting CDATA elements in an XSLT stylesheet

wxdqz

New Member
Hi,I think the best way to explain the problem is to present it with an example.I have an XML file, a.xml:<doc><item>plain thing</item><item><![CDATA[any thing]]></item></doc>I wanted to define two templates in my XSLT stylesheet, one that matches"doc/item" and the other that matches doc/item/CDATA ???I know I can define the former like this:<xsl:template match="/doc/item">...</xsl:template>I do not know what I should be the pattern (if any that is) that would matchelements that have CDATA?Or at least is there a way in side the /doc/item template that I can detectif the node was a CDATA node or a plain node.The reason I want to detect this is to present the XML file's contents coloreddifferently for printing and presentation. I know DOM works, but we foundDOM too slow for large files, and XSLT very fast even as the XML file sizegrew.I would appereciate any help.Thanks,Arun
 
Back
Top