W3C home > Mailing lists > Public > public-xsl-wg@w3.org > April 2016

static base-uri, scenario for absent (Bug #29461)

From: Abel Braaksma <abel.braaksma@xs4all.nl>
Date: Fri, 1 Apr 2016 15:49:18 +0200
To: "Public XSLWG" <public-xsl-wg@w3.org>
Message-ID: <028701d18c1d$4a580e00$df082a00$@xs4all.nl>
During yesterday's call MSMcQ wondered in what scenarios the static base URI of a stylesheet can be absent. We came up with rather esoteric scenarios (i.e., on-the-fly byte-code generation in .NET does not have a location by default, and by extension, any stylesheet module created in such a way doesn't have one).

But there's a more direct way to get a stylesheet module without a static base URI. Consider:

let $n := parse-xml("same xml")
return transform(map { 'stylesheet-node': $n, 'source-node': doc('test.xml') } )

According to recent bug 29398 (Base uri with parse-xml), parse-xml returns a document with no base URI. According to the fn:transform function, you can set a static base URI with the parameter 'stylesheet-base-uri'. If absent, it is taken from 'stylesheet-location' or the base URI of 'stylesheet-node', which is absent in this case. The text in FO31 says about this:

<quote>
stylesheet-base-uri:
The static base URI of the principal stylesheet module. Defaults to the value of stylesheet-location or the base URI of stylesheet-node if available; otherwise absent (which may cause failures, for example if an xsl:include or xsl:import is present with a relative URI). If the value is a relative reference, it is resolved against the static base URI of the fn:transform function call.
</quote>

As you can see, the example above will *not* have a static base URI for the stylesheet and xsl:import etc (if present) may  fail as a result of this, if they use relative URIs.

In turn, we could use this example in the spec (if we feel it adds value) and/or use it as a testcase.

(potentially OT) Of interest is also that a lot that was discussed yesterday seems to be available in section 5.8 URI References, last paragraph. I feel that this section is not entirely complete (though not wrong either), but that's another discussion or issue. It does *not* mention what happens if the static base URI is absent. In fact, it does not use the term "static base URI" everywhere (intermixed with just "base URI"), same is true for section 3.11.1 Locating Stylesheet Modules, which says "the base URI".

Cheers,
Abel
Received on Friday, 1 April 2016 13:49:51 UTC

This archive was generated by hypermail 2.3.1 : Friday, 1 April 2016 13:49:52 UTC