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: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 17 Oct 2006 10:24:44 +0100
> I understand, but it really just said "Transformation 
> failed". Without any descriptive error, warning or whatever. 

That's a bit puzzling. Calling document() with a URI that doesn't exist is a
recoverable error. By default in Saxon that should give you warning
messages, followed by a successful transformation result. You can suppress
the warnings or you can ask for them to be treated as fatal, but I can't
reproduce a situation in which there the transformation fails without having
notified the ErrorListener.

> But from Michael's post, and the others, I think my best bet 
> is to either get rid of xml:base, or to reverse-append it to 
> the document('') function (which will be hard, considering 
> that my xml:base="../..", loosing the path information).

Try putting xml:base at the level of the stylesheet where you need it, e.g.
on a template rule, and have a global variable

<xsl:variable name="stylesheet-uri" select="static-base-uri()"/>

The global variable will then use the "real" base URI of the stylesheet
module.

Michael Kay
http://www.saxonica.com/

Current Thread