cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <>
Subject Re: strange behavior in xslt transformation with document()
Date Sat, 31 Jan 2004 01:12:09 GMT
On 31.01.2004 00:51, BURGHARD Eric wrote:
> Hi everybody,
> While playing with forrest/cocoon/xslt, i found something very strange.
> I've got two different behavior of a document() function inside an xslt
> stylesheet. I don't know if it's a bug or a feature.
> If document() takes its parameter from a stylesheet variable ($filename),
> xalan try to load the file from the same directory than the .xsl file.
> If it takes its parameter from an attribute of the .xml which is being
> transformed (@filename), it try to load the file from the same directory
> than the .xml file.
> Any idea ?

If that's true, it's definitely a bug. Using document() without a second 
parameter should resolve the path relative to the stylesheet. Only 
passing a node-set as second argument changes this behaviour, the path 
is resolved relative to this node-set:

"The URI reference may be relative. The base URI (see [3.2 Base URI]) of 
the node in the second argument node-set that is first in document order 
is used as the base URI for resolving the relative URI into an absolute 
URI. If the second argument is omitted, then it defaults to the node in 
the stylesheet that contains the expression that includes the call to 
the document function. 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."

(XSLT spec, 12.1 Multiple Source Documents,


View raw message