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

RE: Multiple CDATA tags

Subject: RE: Multiple CDATA tags
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 15 Feb 2005 18:08:16 -0000
cdata tags
It looks as if it's closing and reopening the CDATA every time it finds a
"]" or "[", which is quite unecessary.

However, is the receiving application really so sensitive to this? If it is,
perhaps you should be changing it. The consensus is that CDATA boundaries
aren't information-bearing - the receiving application shouldn't care about
the difference between abc and <![CDATA[abc]]> and
<![CDATA[a]]><![CDATA[bc]]> 

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: John Cole [mailto:johnmcole@xxxxxxxxx] 
> Sent: 15 February 2005 17:52
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Multiple CDATA tags
> 
> Hello,
> 
> I'm having what appears to be an issue with libxslt
> (v1.1.6) wrapping text in multiple CDATA tags (see
> code example below).  This same behavior does not
> appear when using Sablotron (which wraps the text in a
> single CDATA tag).  
> 
> I searched the list archives and found mention of a
> similar bug that was submitted some time back:
> http://bugzilla.gnome.org/show_bug.cgi?id=107165
> 
> Would anyone mind taking a look at the code below and
> letting me know if this is the correct or intended
> behavior for libxslt?  Or if perhaps this has been
> addressed in a more recent version, etc.?
> 
> Thank you,
> John Cole
> 
> 
> *** Original XML ***
> 
> <COMPANYTEXT><TEXT TYPE="Synopsis" SUMMARY="Long
> before TV's infamous Ewing clan, A. H. Belo was
> wheeling and dealing in Dallas. The company, now Belo
> Corp., publishes The Dallas Morning News (founded
> 1885), one of the nation's largest newspapers with a
> daily circulation of about 525,000. It publishes three
> other dailies, including The Providence Journal
> (Rhode" CHART="No"><![CDATA[Long before TV's infamous
> Ewing clan, A. H. Belo was wheeling and dealing in
> Dallas. The company, now Belo Corp., publishes <i>The
> Dallas Morning News</i> (founded 1885), one of the
> nation's largest newspapers with a daily circulation
> of about 525,000. It publishes three other dailies,
> including <i>The Providence Journal</i> (Rhode Island)
> and <i>The Press-Enterprise</i> (Riverside,
> California), as well as a handful of community papers
> serving the Dallas-Fort Worth area. Belo also manages
> one and owns 19 TV stations in 10 states, and runs a
> handful of 24-hour cable news channels including Texas
> Cable News and Northwest Cable News. Its burgeoning
> Internet division includes 34 Web
> sites.]]></TEXT></COMPANYTEXT>
> 
> 
> *** Parent XSL template ***
> 
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes"
> omit-xml-declaration="yes"
> cdata-section-elements="SYNOPSIS" />
> <xsl:template match="/">
> <SYNOPSIS>
> 	<xsl:call-template name="dispText">
> 		<xsl:with-param name="type" select="'Synopsis'" />
> 	</xsl:call-template>
> </SYNOPSIS>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> *** Called dispText XSL template ***
> 
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:template name="dispText">
> 	<xsl:param name="type" />
> 	<xsl:param name="withTags" select="'Y'" />
> 	<xsl:if test="$withTags = 'Y'">
> 		<xsl:text>]|[</xsl:text>
> 	</xsl:if>
> 	<xsl:choose>
> 		<xsl:when test="$type = 'Overview'">
> 			...
> 		</xsl:when>        
> 		<xsl:otherwise>
> 			<xsl:if test="$withTags = 'Y'">
> 				<xsl:text>@dt[</xsl:text>
> 			</xsl:if>
> 			<xsl:apply-templates
> select="/FEED/COMPANYTEXT/TEXT[@TYPE = $type]" />
> 			<xsl:if test="$withTags = 'Y'">
> 				<xsl:text>]dt@</xsl:text>
> 			</xsl:if>
> 		</xsl:otherwise>
> 	</xsl:choose>
> 	<xsl:if test="$withTags = 'Y'">
> 		<xsl:text>]|[</xsl:text>
> 	</xsl:if>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> *** Transformed XML, Not wrapped with
> cdata-section-elements tag ***
> 
>   <SYNOPSIS>]|[@dt[Long before TV's infamous Ewing
> clan, A. H. Belo was wheeling and dealing in Dallas.
> The company, now Belo Corp., publishes &lt;i&gt;The
> Dallas Morning News&lt;/i&gt; (founded 1885), one of
> the nation's largest newspapers with a daily
> circulation of about 525,000. It publishes three other
> dailies, including &lt;i&gt;The Providence
> Journal&lt;/i&gt; (Rhode Island) and &lt;i&gt;The
> Press-Enterprise&lt;/i&gt; (Riverside, California), as
> well as a handful of community papers serving the
> Dallas-Fort Worth area. Belo also manages one and owns
> 19 TV stations in 10 states, and runs a handful of
> 24-hour cable news channels including Texas Cable News
> and Northwest Cable News. Its burgeoning Internet
> division includes 34 Web sites.]dt@]|[</SYNOPSIS>
> 
> 
> *** Transformed XML, Wrapped with
> cdata-section-elements tag (using Libxslt 1.1.6) ***
> 
>  
> <SYNOPSIS><![CDATA[]|[]]><![CDATA[@dt[]]><![CDATA[Long
> before TV's infamous Ewing clan, A. H. Belo was
> wheeling and dealing in Dallas. The company, now Belo
> Corp., publishes <i>The Dallas Morning News</i>
> (founded 1885), one of the nation's largest newspapers
> with a daily circulation of about 525,000. It
> publishes three other dailies, including <i>The
> Providence Journal</i> (Rhode Island) and <i>The
> Press-Enterprise</i> (Riverside, California), as well
> as a handful of community papers serving the
> Dallas-Fort Worth area. Belo also manages one and owns
> 19 TV stations in 10 states, and runs a handful of
> 24-hour cable news channels including Texas Cable News
> and Northwest Cable News. Its burgeoning Internet
> division includes 34 Web
> sites.]]><![CDATA[]dt@]]><![CDATA[]|[]]></SYNOPSIS>
> 
> 
> *** Transformed XML, Wrapped with
> cdata-section-elements tag (using Sablotron) ***
> 
>   <SYNOPSIS>
>     <![CDATA[]|[@dt[Long before TV's infamous Ewing
> clan, A. H. Belo was wheeling and dealing in Dallas.
> The company, now Belo Corp., publishes <i>The Dallas
> Morning News</i> (founded 1885), one of the nation's
> largest newspapers with a daily circulation of about
> 525,000. It publishes three other dailies, including
> <i>The Providence Journal</i> (Rhode Island) and
> <i>The Press-Enterprise</i> (Riverside, California),
> as well as a handful of community papers serving the
> Dallas-Fort Worth area. Belo also manages one and owns
> 19 TV stations in 10 states, and runs a handful of
> 24-hour cable news channels including Texas Cable News
> and Northwest Cable News. Its burgeoning Internet
> division includes 34 Web sites.]dt@]|[]]>
>   </SYNOPSIS>

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.