This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Help : Problem with CDATA section
- To: xsl-list at mulberrytech dot com
- Subject: Help : Problem with CDATA section
- From: "Masaoud T. Moonim" <masaoud at mailandnews dot com>
- Date: Wed, 02 Aug 2000 16:47:37 +0530
- Reply-To: xsl-list at mulberrytech dot com
Hi all,
I am a little new to XML/XSL and need some help on the following :
Here is my XML file :
-----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<CONTENT>
<HTMLDATA>
<![CDATA[
<html>
<head>
</head>
<body>
]]>
</HTMLDATA>
<OTHER>
This is the first text
</OTHER>
<HTMLDATA>
<![CDATA[
</body>
</html>
]]>
</HTMLDATA>
</CONTENT>
-----------------------------------------------------------------------
Here is my XSL StyleSheet :
-----------------------------------------------------------------------
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output cdata-section-elements="HTMLDATA" mode="xml"/>
<xsl:template match="/">
<xsl:apply-templates select="CONTENT"/>
</xsl:template>
<xsl:template match="CONTENT">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="HTMLDATA">
<xsl:copy>
<xsl:value-of select="." disable-output-escaping="yes"/>
</xsl:copy>
</xsl:template>
<xsl:template match="OTHER">
<xsl:value-of select"."/>
</xsl:template>
</xsl:stylesheet>
-----------------------------------------------------------------------
I want to write a XSL which will some how copy all the 'HTMLDATA'
content as is to the output document, including the 'CDATA'
sections. Only the 'OTHER' tags are to be processed.
The output should look like this :
-----------------------------------------------------------------------
<HTMLDATA>
<![CDATA[
<html>
<head>
</head>
<body>
]]>
</HTMLDATA>
This is the first text
<HTMLDATA>
<![CDATA[
</body>
</html>
]]>
</HTMLDATA>
-----------------------------------------------------------------------
Can anyone please help me write a XSL which will output the CDATA as
is to the output document.
NOTE: I already tried using the following :
<xsl:output cdata-section-elements="HTMLDATA"/>
but this does not work. I am using the XT processor to perform the
translation.
Thanks in Advance !
Regards
Masaoud
-----------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list