[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Urgent : Problem with CDATA section

Subject: Urgent : Problem with CDATA section
From: "Masaoud T. Moonim" <masaoud@xxxxxxxxxxxxxxx>
Date: Mon, 31 Jul 2000 19:22:44 +0530
xml htmldata
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.