XSLT Transform CDATA Missing ] After Upgrade To 11.2.0.2 (Doc ID 1384584.1)

Last updated on JULY 17, 2017

Applies to:

Oracle XML Developers Kit - Version 11.2.0.2 to 11.2.0.4 [Release 11.2]
Information in this document applies to any platform.
***Checked for relevance on 31-Jan-2014***

Symptoms

After upgrade to 11.2.0.2, XML transformation using XSLT is behaving differently than prior release(s),  with the 11.2 release the CDATA is missing a bracket "]".

The following "bad" source outputs from 11g demonstrate the missing bracket:

SET SERVEROUTPUT ON
DECLARE
V_XML_DATA xmltype := XMLTYPE('<?xml version = "1.0"?>
<DUMMY>
</DUMMY>');
--
V_xsl xmltype := xmltype('
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" indent="yes"/>
<xsl:variable name="myVariable">
<xsl:text disable-output-escaping="yes"><![CDATA[[]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA["this text should be
between angled brackets"]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[]]]></xsl:text>
</xsl:variable>
<xsl:template match="/">
<xsl:text disable-output-escaping="yes"><![CDATA[
<html>
<header>
<script type="text/javascript" language="javascript">
alert("Before declaration of variable titi");
var titi = ]]>
</xsl:text>
<xsl:value-of select="$myVariable"/>;
<xsl:text disable-output-escaping="yes"><![CDATA[
alert("After declaration of variable titi");
</script>
</header>
<body>
hello world!
</body>
</html>
]]>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
');
V_NEW_XML_DATA xmltype;
BEGIN
   SELECT XMLTRANSFORM(V_XML_DATA,V_XSL)
   INTO V_NEW_XML_DATA
   FROM DUAL;
 DBMS_OUTPUT.PUT_LINE('Via SQL XMLTRANSFORM');
 DBMS_OUTPUT.PUT_LINE(V_NEW_XML_DATA.GETCLOBVAL());
 DBMS_OUTPUT.NEW_LINE;
 DBMS_OUTPUT.PUT_LINE('Via PL/SQL TRANSFORM');
    v_new_xml_data := v_xml_data.transform(v_xsl);
 DBMS_OUTPUT.PUT_LINE(V_NEW_XML_DATA.GETCLOBVAL());
END;
/




OUTPUT (11.2.0.3)  --> note the missing ]

<html>
<header>
<script type="text/javascript" language="javascript">
alert("Before declaration of variable titi");
var titi = ["this text should be between angled brackets";
alert("After declaration of variable titi");
</script>
</header>
<body>
hello world!
</body>
</html>

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms