[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Getting the current document from an xsl:function


Subject: Re: [xsl] Getting the current document from an xsl:function
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 28 Jun 2012 10:46:57 +0100

But base-uri($node) doesn't return the base URI of the stylesheet, it returns the base URI of the specified node (which in common cases will be the the URI of the document containing that node).

To get the base URI of the current stylesheet module (or more strictly, the base URI of the current expression in the stylesheet), use the static-base-uri() function. (Different parts of a stylesheet module can have different base URIs if you use xml:base, or if parts of the stylesheet are contained in external entities).

There's no way to determine the base URI of the "currently executing main stylesheet" unless you put a global variable in the principal stylesheet module and bind it to static-base-uri() (and avoid using xml:base or external entities, and ensure that the API via which the stylesheet is loaded actually preserves the URI information...)

Michael Kay
Saxonica

On 28/06/2012 10:12, Abel Braaksma wrote:
Hi Andrew,

The current dir of the currently executing stylesheet. Every
xsl:function is contained in a stylesheet and the currently executing
main stylesheet is also known, so theoretically this "context" should
(could) be available.

Abel


On 28-6-2012 11:07, Andrew Welch wrote:
Hi Abel,

The reaon I ask is that I'd like to be able to find the current
dir from places where there is no context.
What current dir are you looking for when there is no context?


Current Thread