W3C home > Mailing lists > Public > public-qt-comments@w3.org > June 2012

[Bug 17595] New: [XP 3.0] Static base URI revisited

From: <bugzilla@jessica.w3.org>
Date: Tue, 26 Jun 2012 08:21:30 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-17595-523@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=17595

           Summary: [XP 3.0] Static base URI revisited
           Product: XPath / XQuery / XSLT
           Version: Working drafts
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XPath 3.0
        AssignedTo: jonathan.robie@gmail.com
        ReportedBy: mike@saxonica.com
         QAContact: public-qt-comments@w3.org


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.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Tuesday, 26 June 2012 08:21:38 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:39 UTC