Subject: Re: [xsl] Getting the current document from an xsl:function From: Abel Braaksma <abel.online@xxxxxxxxx> Date: Thu, 28 Jun 2012 12:02:43 +0200 |
On 28-6-2012 11:46, Michael Kay wrote: > 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). My bad. I often run stylesheets against themselves for the sake of convenience when I don't require an input document. I should've mentioned that in my first post and obviously, it won't work the minute I change this practice. > 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). I wasn't aware of the existence of that function (odd, considering we implemented and tested it). But this looks like exactly what I needed. > 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...) A lot of buts, but a workaround that could work in trivial circumstances, thanks.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Getting the current docum, Michael Kay | Thread | [xsl] Balisage 2012 Silent Auction, Sam Wilmott |
Re: [xsl] Getting the current docum, Michael Kay | Date | [xsl] Balisage 2012 Silent Auction, Sam Wilmott |
Month |