[Bug 5207] [XQuery] Accessing undefined static context base URI and XPST0001

http://www.w3.org/Bugs/Public/show_bug.cgi?id=5207





------- Comment #5 from mike@saxonica.com  2007-11-17 00:02 -------
(Action ACTION A-344-03)

As expected, the more you dig into this the deeper the hole you find yourself
in.

Firstly, I think that XDM should make it more clear that the base URI of a node
may be unknown. In practice this is common, it happens whenever you parse an
XML document supplied as a string in memory. The possibility is also recognized
(more or less) in the Infoset. This seems to require changing (or clarifying
the meaning of) section 6.1.3 where it says "The following infoset properties
are required: [children] and [base URI].". XDM allows the base-uri() accessor
to return (), and we should make it clear that this is what happens when the
base URI property of a node is unknown.

Secondly, XQuery needs to make it clear (as suggested in the bug report) that
for element nodes as well as document nodes, if the static base URI is unknown
then the base URI of the constructed node will be unknown. (I think "unknown"
is a better term here than "empty", which is the term used for document node
constructors.

In fact, there are many, many places in XQuery and XSLT where the base URI of
one thing is taken from the base URI of another. We really don't want to change
all these places to say explicitly that if the first base URI is unknown then
the second base URI will also be unknown. I think it would be best to say it
once, and a good place seems to be XQuery 4.5. Change:

"It is not intrinsically an error if this process fails to establish an
absolute base URI; however, the base URI in the static context is then
undefined, and any attempt to use its value may result in an error
[err:XPST0001]."

to

"It is not intrinsically an error if this process fails to establish an
absolute base URI; however, the base URI in the static context is then
undefined. When the base URI in the static context is undefined, any attempt to
use its value to resolve a relative URI reference will result in an error
[err:XPST0001]. When the base URI of a constructed node is taken from the base
URI in the static context and the latter is undefined, then the base URI of the
node will be unknown."

This makes the current sentence in 3.7.3.3. 4(a) redundant.

I've looked through XSLT to see whether the same changes need to be made there.
Frankly, I don't think it's necessary. There are many places where the base
URIs are copied from one place to another and I think it's reasonable for
readers to infer that if the source base URI is unknown/undefined then the
target base URI will be unknown/undefined.

Received on Saturday, 17 November 2007 00:02:49 UTC