SELECT XMLTYPE....TRANSFORM... Returns Blank Result (Doc ID 1287642.1)

Last updated on JANUARY 25, 2011

Applies to:

Oracle Server - Enterprise Edition - Version: 11.1.0.6 to 11.2.0.2 - Release: 11.1 to 11.2
Information in this document applies to any platform.

Symptoms

This query returns a blank result in SQL*Plus:

SQL> SELECT XMLTYPE ('<X>1</X>').TRANSFORM (XMLTYPE ('<xsl:stylesheet version="1
.0" xmlns:xsl="');" href="http://www.w3.org/1999/XSL/Transform%22>" name="contextTextUrl_1292004626313" target="_blank" oncontextmenu="" title="Click (or CTRL+Click if using Firefox) to view">http://www.w3.org/1999/XSL/Transform">
  2  <xsl:output indent="yes" omit-xml-declaration="yes" method="xml"/>
  3  <xsl:template match="/*">
  4  <xsl:value-of select="." />
  5  </xsl:template>
  6  </xsl:stylesheet>')) AS X FROM DUAL;

X
--------------------------------------------------------------------------------



SQL>



It works:
a.  in 10.2.0.5.0:

SQL> SELECT XMLTYPE ('<X>1</X>').TRANSFORM (XMLTYPE ('<xsl:stylesheet version="1
.0" xmlns:xsl="');" href="http://www.w3.org/1999/XSL/Transform%22>" _djrealurl="http://www.w3.org/1999/XSL/Transform%22>" name="contextTextUrl_1292003719660" target="_blank" oncontextmenu="" title="Click (or CTRL+Click if using Firefox) to view">http://www.w3.org/1999/XSL/Transform">
  2  <xsl:output indent="yes" omit-xml-declaration="yes" method="xml"/>
  3  <xsl:template match="/*">
  4  <xsl:value-of select="." />
  5  </xsl:template>
  6  </xsl:stylesheet>')) AS X FROM DUAL;

X
--------------------------------------------------------------------------------

1

SQL>

b.  in 11.1.0.7.0, 11.2.0.1.0 and 11.2.0.2.0 if a space or a zero precedes the 1:

SQL> SELECT XMLTYPE ('<X> 1</X>').TRANSFORM (XMLTYPE ('<xsl:stylesheet version="1
.0" xmlns:xsl="');" href="http://www.w3.org/1999/XSL/Transform%22>" name="contextTextUrl_1292004626313" target="_blank" oncontextmenu="" title="Click (or CTRL+Click if using Firefox) to view">http://www.w3.org/1999/XSL/Transform">
  2  <xsl:output indent="yes" omit-xml-declaration="yes" method="xml"/>
  3  <xsl:template match="/*">
  4  <xsl:value-of select="." />
  5  </xsl:template>
  6  </xsl:stylesheet>')) AS X FROM DUAL;

X
--------------------------------------------------------------------------------
1

SQL> SELECT XMLTYPE ('<X>01</X>').TRANSFORM (XMLTYPE ('<xsl:stylesheet version="1
.0" xmlns:xsl="');" href="http://www.w3.org/1999/XSL/Transform%22>" name="contextTextUrl_1292004626313" target="_blank" oncontextmenu="" title="Click (or CTRL+Click if using Firefox) to view">http://www.w3.org/1999/XSL/Transform">
  2  <xsl:output indent="yes" omit-xml-declaration="yes" method="xml"/>
  3  <xsl:template match="/*">
  4  <xsl:value-of select="." />
  5  </xsl:template>
  6  </xsl:stylesheet>')) AS X FROM DUAL;

X
--------------------------------------------------------------------------------
01

SQL>

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