[Bug 4373] [F+O] resolve-uri() where $base is relative

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





------- Comment #2 from mike@saxonica.com  2007-04-03 21:33 -------
The WGs reviewed this today. It was accepted that RFC 3986 makes it fairly
clear that the algorithm it describes for resolving a "relative reference"
(which we incorrectly refer to as a relative URI) is intended to take an
absolute hierarchic URI as the base URI input, and to produce an absolute
hierarchic URI as the result. I was asked to produce a concrete wording
proposal for an erratum. Here is proposed wording:

Summary: This function enables a relative URI reference to be resolved against
a base URI to produce an absolute URI.

The first form of this function resolves $relative against the value of the
base-uri property from the static context. If the base-uri property is not
initialized in the static context an error is raised [err:FONS0005].

If $relative is a relative URI reference, it is resolved against $base, or
against the base-uri property from the static context, using an algorithm such
as those described in [RFC 2396] or [RFC 3986], and the resulting absolute URI
reference is returned. 

If $relative is an absolute URI reference, it is returned unchanged.

If $relative is the empty sequence, the empty sequence is returned.

If $relative is not a valid URI according to the rules of the xs:anyURI data
type, or if it is not a suitable relative reference to use as input to the
chosen resolution algorithm then an error is raised [err:FORG0002].

If $base is not a valid URI according to the rules of the xs:anyURI data type,
or if it is not a suitable URI to use as input to the chosen resolution
algorithm (for example, if it is a relative URI reference, if it is a
non-hierarchic URI, or if it contains a fragment identifier) then an error is
raised [err:FORG0002].

If the chosen resolution algorithm fails for any other reason then an error is
raised [err:FORG0009].

Notes:

Resolving a URI does not dereference it. This is merely a syntactic operation
on two character strings.

The algorithms in the cited RFCs include some variations that are optional or
recommended rather than mandatory; they also describe some common practices
that are not recommended, but which are permitted for backwards compatibility.
Where the cited RFCs permit variations in behavior, so does this specification.

Received on Tuesday, 3 April 2007 21:33:58 UTC