Re: [xsl] Obtaining the base output uri from within xsl

Subject: Re: [xsl] Obtaining the base output uri from within xsl
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 14 Dec 2011 12:14:45 +0000
> I've been looking at the xsl functions for some way of gaining the base output uri, or better still, the output document name. I can find how to get the input document, the static context, but not the output document name.
>
> I'm using Saxon with the -o parameter, so I could add an extra parameter to my stylesheet such as "outputURI=x", but that would seem messy.
>
> I'm sure it's really obvious, but I've not found anything yet.

It's because 'normally' the stylesheet isn't responsible for writing
the output to disk, the xsl:output values are only hints to the
processor... so there isn't a way to discover the output filepath.

You can however take control of the serialisation yourself within the
transform by using xsl:result-document, something like:

<xsl:template match="/">
  <xsl:result-document href="$some-path">
   ...

that way you know the output path.


-- 
Andrew Welch
http://andrewjwelch.com

Current Thread