My Oracle Support Banner

Xml Transformation Adds The Namespace Twice To The Root Element (Doc ID 1366323.1)

Last updated on MARCH 01, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 11.1.0.7 to 11.2.0.3 [Release 11.1 to 11.2]
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Information in this document applies to any platform.

Symptoms

Using XMLtype.Transform(), the namespace attribute is added twice to the root element.

Code Example

DECLARE
v_xml XMLtype;
v_xsl XMLtype;
v_result XMLtype;
content CLOB;

begin
v_xsl := xmltype(
'<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>');

v_xml := xmltype(
'<rootNode xmlns="http://www.europace.ie/xsd/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<testNode>hello World</testNode>
</rootNode>');

v_result := v_xml.transform(xsl => v_xsl);
content := v_result.getClobVal();
dbms_output.put_line(CONTENT);
end;
/


This generates the following output in 11.1.0.7, 11.2.0.1 and 11.2.0.2:

<rootNode xmlns="http://www.europace.ie/xsd/" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      
     xmlns="http://www.europace.ie/xsd/"> 
  <testNode>hello World</testNode>
</rootNode>


while in 10.2.0.5 the output is correct

<rootNode xmlns="http://www.europace.ie/xsd/" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <testNode>hello World</testNode>
</rootNode>

 

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

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


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.