[whatwg] <base> versus xml:base

Bjoern Hoehrmann derhoermi at gmx.net
Wed Mar 14 11:32:32 PDT 2007

* Asbjørn Ulsberg wrote:
>Let's say the document from my example was located on  
>'http://users.example.org/bob/'. According to the XML Base specification,  
>the initial base URI of the document (in this example) is «the URI used to  
>retrieve the entity». Since 'xml:base' affects <base>, and not the other  
>way around (I would presume), the base URI of the document, after  
>processing the <base> element, should be:
>   http://users.example.org/bar
>That is, if 'xml:base' is processed before the <base> element. And  
>according to the XML Base specification, I'd say that is the case. If not,  
><base> is a special case element where 'xml:base' doesn't apply or is  
>applied after the 'href' value has been resolved.

It is not very useful to make these assumptions. The problem here is
that you have a cycle in the lookup algorithm. If you have a relative
reference you do this under both xml:base and <base> processing:

  rel ref -> base of element -> base of parent -> ... <base> or else
                                                  ... document base

If the relative reference is in the <base href> attribute, the algo-
rithm would not terminate. The XML Base specification does not address
this problem in any way. The minimal approach to break the cycle would
be to define what happens if resolving <base href> depends on resolving
<base href>. A simple solution would be to ignore the base element for
the purposes of determining the base of any element.

Note that some of the suggestions made in this thread would give quite
surprising results e.g. when using XInclude.
Björn Höhrmann · mailto:bjoern at hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

More information about the whatwg mailing list