My Oracle Support Banner

XSLT Document('') Function does not Return the Stylesheet (Doc ID 1337045.1)

Last updated on JANUARY 30, 2022

Applies to:

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


When an empty string is passed to the XSLT Document() function it should parse the current stylesheet and return a single node, the root node of the stylesheet itself as stated in the W3C Standard (  So when running a transformer in the database using the following XSL with document(''):

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"xmlns:xsl="">
<xsl:template match="/">
<xsl:copy-of select="document('')"/>

The stylesheet should be returned.  Instead we see either <doc/> or <doc><doc/>

Note the W3C Standard states:

12.1 Multiple Source Documents
Function: node-set document(object, node-set?)
Note that a zero-length URI reference is a reference to the
document relative to which the URI reference is being resolved;
thus document("") refers to the root node of the stylesheet; the tree
representation of the stylesheet is exactly the same as if the XML
document containing the stylesheet was the initial source document.


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

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