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

RE: XSL & CDATA Processing

Subject: RE: XSL & CDATA Processing
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Tue, 29 Jun 2004 08:59:30 +0100
cdata xsl
Weird. How are you running this transformation (what XSLT processor, what
XML parser, and how are you invoking it?)

Michael Kay 

> -----Original Message-----
> From: Rohit Mathur [mailto:geek_on_line@xxxxxxxxx] 
> Sent: 29 June 2004 03:21
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  XSL & CDATA Processing
> 
> Hi,
> 
> I am trying to perform an XSL transform for an XML
> Document to remove duplicate Nodes. The XML file is as
> below
> 
> <Test>
>   <Text LineCount="29" Object="RECORD" Status="?"
> Version="000">
>     <Text.Description><![CDATA[Table
> File]]></Text.Description>
>     <Text.LongDescription><![CDATA[Table
> File]]></Text.LongDescription>
>   </Text>
> 
>   <Text LineCount="29" Object="RECORD" Status="?"
> Version="000">
>     <Text.Description><![CDATA[Table
> File]]></Text.Description>
>     <Text.LongDescription><![CDATA[Table
> File]]></Text.LongDescription>
>   </Text>
> </Test>
> 
> 
> The XSL stylesheet I am using to do this is as below.
> 
> <xsl:stylesheet
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="1.0" >
>   <xsl:output method="xml"
> omit-xml-declaration="yes"/>
>    <xsl:template match="Text">
>       <xsl:if test="not(@Object =
> preceding::Text/@Object)">
>         <xsl:copy>
>           <xsl:apply-templates select="@*|node()"/>
>         </xsl:copy>
>       </xsl:if>
>    </xsl:template>
>    
>     <xsl:template match="@*|node()">
>       <xsl:copy>
>         <xsl:apply-templates select="@*|node()"/>
>       </xsl:copy>
>     </xsl:template>
> </xsl:stylesheet>
> 
> The output generated removes the duplicate node but
> somehow doesn't process the CDATA sections properly.
> 
> <Test>
>   <Text LineCount="29" Object="RECORD" Status="?"
> Version="000">
>     &lt;![CDATA[<Text.Description>]]&gt;Table
> File</Text.Description>
>     &lt;![CDATA[<Text.LongDescription>]]&gt;Table
> File</Text.LongDescription>
>   </Text>  
> </Test>
> 
> I have tried adding a "cdata-section-elements" section
> to the xsl:ouput tag telling it to treat
> Text.Description & Text.LongDescription as CDATA.
> This creates the following output
> 
> <Test>
>   <Text LineCount="29" Object="RECORD" Status="?"
> Version="000">
>    
> &lt;![CDATA[<Text.Description><![CDATA[]]]]><![CDATA[>]]><![CD
> ATA[Table
> File]]></Text.Description>
>    
> &lt;![CDATA[<Text.LongDescription><![CDATA[]]]]><![CDATA[>]]><
> ![CDATA[Table
> File]]></Text.LongDescription>
>   </Text>
> </Test>  
> 
> Can anyone help me?
> 
> Cheers
> Rohit.
> 
> Find local movie times and trailers on Yahoo! Movies.
> http://au.movies.yahoo.com
> 
> --+------------------------------------------------------------------
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
> or e-mail: <mailto:xsl-list-unsubscribe@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
> 


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.