RE: [F&O] fn:resolve-uri and non-hierarchical base URI

> 
> Rereading RFC 3986 it seems clear that relative URIs and 
> relative URI resolution
> works only for hierarchical URI schemes.  It says ...
> 
> "Some URI schemes do not allow a hierarchical syntax matching the
>    <hier_part> syntax, and thus cannot use relative references."
> 
> And, as Colin points out, the base URI needs to be an absolute URI.
> 
> Thus, it seems to me that all we need to change in fn:resolve-URI 
> is to add the sentence from RFC 3986 quoted above. 
> 

Yes: the new RFC does seem to lead us in this direction.

However, URIs are a minefield and we need to tread carefully. For example,
when resolving R against B, if R is an absolute URI the result should be R,
and the value of B should be ignored.

Another problem: although the RFC says that URI resolution only makes sense
for hierarchical URIs, it doesn't make it clear how one decides whether a
given URI is hierarchical. This seems to be a property of the URI scheme,
not a property of the URI itself, and new URI schemes of course can be
invented over time. The actual algorithm given seems to work whether or not
the URI scheme is hierarchical.

I think we also need some clarification at the data model level (and indeed
in the xml:base specification). There is currently nothing in the data
model, or the infoset, or XML base, that says that the base URI of a node
must be an absolute and/or hierarchic URI. If we believe that resolving a
relative URI only makes sense against an absolute hierarchic URI then we
need to ensure that the base URI of a node is always in this form.

I think the intent of the XML Base specification is that the value of the
xml:base attribute can be a relative URI, and the [base URI] property of the
node is then obtained by resolving this relative URI against the [base URI]
of its parent element (or of the document entity or external entity in which
it appears). (The intent is clear from the example in section 3 of XML Base,
but there is no text to back it up).  

Michael Kay

Received on Wednesday, 9 February 2005 00:01:00 UTC