This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 17595 - [XP 3.0] Static base URI revisited
Summary: [XP 3.0] Static base URI revisited
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XPath 3.0 (show other bugs)
Version: Working drafts
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
: 16583 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-26 08:21 UTC by Michael Kay
Modified: 2013-06-19 09:27 UTC (History)
1 user (show)

See Also:


Attachments

Description Michael Kay 2012-06-26 08:21:31 UTC
In bug #11561 I proposed that we should recognize that the development and deployment location of a query or stylesheet might be different. This modest suggestion morphed into a proposal to have both a "static base URI" and a"dynamic base URI" in the context. The way that this has been implemented has caused immense confusion, for example the fact that the static-base-uri() function is defined to return the dynamic base URI. Numerous test results have been challenged, and it has been suggested that we have introduced a backwards incompatibility.

I propose that we undo this change, which was made in a way that barely achieves the original purpose, and at the same time introduces lots of unwanted side effects. Instead, I make an alternative proposal as follows.

Every expression has in its static context a base URI, called the static base URI. This is available via the fn:static-base-uri function, and it also plays a role in the semantics of other expressions, for example a call to the fn:doc function.

In XQuery:

* all expressions within a module have the same static base URI; this is referred to as the module base URI.

* if the module contains a base URI declaration and the URI supplied in this declaration is an absolute URI, then this URI acts as the module base URI.

* If the module contains a base URI declaration and the URI supplied in this declaration is a relative reference, then the module base URI is obtained by resolving this relative reference against the resource URI of the module (defined below).

* If the module contains no base URI declaration, then the module base URI is the resource URI of the module (defined below).

* The resource URI of a module is implementation-defined. If the text of the query is contained in a resource accessible via a known URI, obtained in a way that respects the intent of RFC 3986, then it is RECOMMENDED that by default, implementations use this URI as the resource URI of the module.

* Some implementations may allow the output of the static analysis phase of query processing (a "compiled query") to be created in a different location from that where it is executed. Furthermore, query authors may in such cases which to avoid exposing the resource location in which the query was developed. In cases where the module base URI depends on the resource URI of the module, implementations MAY therefore use different resource URIs to compute the module base URI during static analysis and during query execution (for example, an implementation MAY use different base URIs for resolving "import module" references and for resolving a relative reference used as an argument to the fn:doc function). In such cases an implementation MUST document how the module base URI is computed for each situation in which it is required.

In XPath:

* the static base URI of an expression is determined by the rules of the host language.

* Where XPath expressions are embedded in an XML document, the host language MAY typically (but not necessarily) specify that the static base URI of an expression is the base URI of the element information item that immediately contains the expression.

* Where XPath expressions are created and executed within a conventional programming language such as C or Java, the host language (in this case the API specification for XPath invocation) MAY typically (but not necessarily) specify that by default, the static base URI of an expression is the current working directory.

in XSLT:

* The static base URI of an expression is the base URI of the element information item that immediately contains the expression

* The base URI used for resolving relative references appearing in non-expression contexts (for example, the href attribute of xsl:include and xsl:import, and the collation and default-collation attributes of various elements) is the base URI of the element information item that immediately contains the expression

* The base URI of an element information item is determined according to the rules of [XML Base], which in turn refers to [RFC 3986]. To quote [XML Base], The rules for determining the base URI can be summarized as follows (highest priority to lowest):

- The base URI is embedded in the document's content.

- The base URI is that of the encapsulating entity (message, document, or none).

- The base URI is the URI used to retrieve the entity.

- The base URI is defined by the context of the application.

* In all cases where there is no xml:base attribute whose value is an absolute URI, these rules give implementations some discretion in determining the base URI of a stylesheet module. 

* Some implementations may allow the output of the static analysis phase of stylesheet processing (a "compiled stylesheet") to be created in a different location from that where it is executed. Furthermore, stylesheet authors may in such cases which to avoid exposing the resource location in which the stylesheet was developed. In cases where the static base URI depends on the base URI of the resource containing a stylesheet module, implementations MAY therefore use different resource URIs to compute the base URI during static analysis and during stylesheet execution (for example, an implementation MAY use different base URIs for resolving xsl:import module references and for resolving a relative reference used as an argument to the fn:doc function). In such cases an implementation MUST document how the base URI is computed for each situation in which it is required.
Comment 1 Jonathan Robie 2012-07-23 14:26:16 UTC
The WG adopted this proposal as the resolution of this bug:

http://lists.w3.org/Archives/Member/w3c-xsl-query/2012Jul/0049.html
Comment 2 Jonathan Robie 2012-07-23 14:26:56 UTC
*** Bug 16583 has been marked as a duplicate of this bug. ***
Comment 3 Michael Kay 2012-07-30 15:30:41 UTC
All changes implemented in CVS.
Comment 4 Jonathan Robie 2012-09-21 21:19:22 UTC
Reopening - this is now moot because we no longer distinguish static base URI and dynamic base URI.
Comment 5 Michael Kay 2012-09-21 21:46:31 UTC
I'm not sure whether you are using "moot" in the British sense of "needs discussion" or the American sense of "not worth discussing": since you are re-opening the bug, the former seems more likely. But I can't see why the fact that we've decided the issue raised in this bug report is a reason for reopening the bug. Could you explain?
Comment 6 Jonathan Robie 2012-09-21 22:15:07 UTC
I messed up. I thought I was reopening Bug 16565, so that I could close it again with an appropriate resolution that takes this bug into account.