Re: Is this use of BASE kosher?

Vincent Tkac (tkac@oclc.org)
Fri, 4 Aug 95 08:33:42 EDT

"Owen Rees" <rtor@ansa.co.uk>writes:
>
> Problems arise only when the BASE is not a valid URI for the document
> that contains it. In the evolution of the HTML 2.0 spec somewhere
> between -01 and -04, the words
>
> The Base element allows the URL of the document itself
> to be recorded in situations in which the document may
> be read out of context.
>
> have been removed, and there is no longer any clear statement that the
> URI in BASE should be treated as a URI for this document. I have
> already pointed out that by working back from the statement in 7.4
> about the '#fragment' degenerate case and the rule in 7.1, it can be
> deduced that the base URI must refer to "the same document".
>
> The options seem to be:
> 1) BASE is only for resolving relative URLs, it may be a URI for a
> different resource.
> 2) BASE must be a URI for this document

Case 2 assumes that the document exists and was not simply produced
dynamically by a script. There are cases where the base can't point
to the URI for the document because the document doesn't have one.

So, since the document is produced by a script, why not have the
script produce absolute URI and not use the base, right? Well, the
script may be assembling document fragments that contain relative URIs
and have no choice in the matter (perhaps a standard toolbar). I
don't think we should be unnecessarily restrictive by requiring the
base to be a URI to the document.

How about:

If the base ends in a '/' then it is a base for relative URI
references and '#frag" refers to "this#frag".

If the base does not end in a '/' then it is to be treated as the URI
for the current document as well as the base for relative URI
references and "#frag" refers to "this#frag" or "base#frag" depending
on whether the document has expired.

Vince Tkac
tkac@oclc.org