My Oracle Support Banner

XMLTYPE.TRANSFORM Fails With LPX-00658 (Doc ID 2112393.1)

Last updated on APRIL 12, 2022

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

Symptoms

XMLTYPE.TRANSFORM fails when XSL contains this xsl:if condition

SQL> DECLARE
2 lvXML CLOB ;
3 lvXSL CLOB ;
4 lvTransform XMLTYPE ;
BEGIN
5 6 lvXML := '<OUTPUT/>' ;
7 lvXSL := '<?xml version="1.0" encoding="UTF-16"?>'
8 || '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">'
9 || ' <xsl:output method="xml" version="1.0" encoding="UTF-16"/>'
10 || ' <xsl:template match="/">'
11 || ' <xsl:if test="not( ''NODE'' | ''NODE'' != '''' )">0</xsl:if>' -- Causes ORA-31011
12 || ' </xsl:template>'
|| '</xsl:stylesheet>' ;
13 14 lvTransform := XMLTYPE( SUBSTR( lvXml, 1, 40000 ) ).Transform( XMLTYPE( SUBSTR( lvXsl, 1, 40000 ) ) ) ;
15 END ;
16 /

ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00658: Invalid XSLT object type.
ORA-06512: at "SYS.XMLTYPE", line 187
ORA-06512: at line 14

This behavior reproduces on 12.1.0.1 and 11.2.0.4.

On 10.2.0.5 it fails with:

SQL> SELECT XMLtype.transform(xmltype('<test>test</test>'),xmltype('<?xml
version="1.0" encoding="UTF-8"?>
2 <xsl:stylesheet version="1.0"
3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 <xsl:template match="@* | node()">
5 <xsl:copy>
6 <xsl:apply-templates select="@* | node()"/>
7 </xsl:copy>
8 </xsl:template>
9 <xsl:template
match="*[not(descendant-or-self::*[text()|normalize-space()])]"/>
10 </xsl:stylesheet>')) from dual;
ERROR:
ORA-3113: end-of-file on communication channel

no rows selected

 

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.