[xsl] Multiple CDATA tags

Subject: [xsl] Multiple CDATA tags
From: John Cole <johnmcole@xxxxxxxxx>
Date: Tue, 15 Feb 2005 09:51:44 -0800 (PST)
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