Canonicalization xml:base processing

To fix up the xml:base attribute of an element E:

If the base URI of the immediate container of E is known (and is
therefore by definition absolute), determine the base URI of E
according to xml:base.  Set the xml:base attribute to this value.

If the base URI of E's container is not known (which can only be the
case if the base URI of the document is unknown, and there is no
ancestor element with an absolute xml:base attribute), proceed as
follows:

 - if there is no ancestor with an xml:base attribute, leave E's
   xml:base attribute (if any) unchanged;

 - if the nearest ancestor with an xml:base is not being omitted,
   leave E's xml:base attribute (if any) unchanged;

 - otherwise we must construct an xml:base attribute giving E's base
   URI relative to the nearest non-omitted ancestor with an xml:base
   attribute; call this ancestor A).  Find the xml:base attributes of
   the omitted ancestor elements between A and E.  Take these in
   outer-to-inner order, followed by the E's xml:base attribute if it
   has one.  This is a sequence of relative URIs.  Discard the last
   segment - the characters after the last slash - of all but the last
   of these.  If any of these URIs has no slash character, discard it
   completely.  Concatenate the resulting strings, and use this as the
   xml:base attribute of E.

-- Richard

Received on Wednesday, 10 May 2006 17:02:25 UTC