Re: [xsl] Referring to stylesheet itself, possible in XSLT 1.0, but how in XSLT 2.0?

Subject: Re: [xsl] Referring to stylesheet itself, possible in XSLT 1.0, but how in XSLT 2.0?
From: "Andrew Welch" <andrew.j.welch@xxxxxxxxx>
Date: Tue, 17 Oct 2006 14:45:21 +0100
On 10/17/06, Abel Braaksma <abel.online@xxxxxxxxx> wrote:
David Carlisle wrote:
> Incidentally, why do you want to use document('')??

No reason in particular, other than getting the stylesheet that is
currently being executed. I tried all sorts of ideas and combinations of
ideas, but the result is simple: it cannot be done once you have the
xsl:stylesheet offset to some directory where your current stylesheet
does not reside.

So, if your stylesheet uses something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="2.0" xml:base="../..">

but is itself not at location "../..", all bets are off for getting the
location of the current stylesheet.

Instead of using xml:base why not just create a parameter $path and then modify all of your paths in the stylesheet to contain that parameter, eg:

<xsl:param name="path" select="'../../'" as="xs:string"/>

and

href="{$path}existingpath"


cheers andrew

Current Thread