This document proposes syntax for providing the equivalent of HTML BASE
functionality generically in XML documents by defining an XML attribute named
The XML Linking Working Group, with this 21 February 2000 XBase Last Call working draft, invites comment on this specification. The Last Call period begins 21 February and ends 20 March 2000.
The W3C Membership and other interested parties are invited to review the specification and report early implementation experience. Please send comments to email@example.com (archive).
While we welcome implementation experience reports, the XML Linking Working Group will not allow early implementation to constrain its ability to make changes to this specification prior to final release.
For background on this work, please see the XML Activity Statement.
A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR.
The XML Linking Language [XLink] defines XML constructs to describe links between resources. One of the stated requirements on XLink is to support HTML 4.0 [HTML40] linking constructs in a generic way. The HTML BASE element is one such construct which the XLink Working Group has considered. BASE allows authors to explicitly specify a document's base URI for the purpose of resolving relative URIs in links to external images, applets, form-processing programs, style sheets, and so on.
This document proposes that the functionality of BASE be provided to generic XML applications. Furthermore it proposes that the resolution of relative URIs is not limited to the domain of XLink but is applicable to any XML application that makes use of relative URIs. In other words, this problem should be solved at the addressing (URI) level and not at the higher level of linking (XLink).
This document introduces a syntax for a generic BASE functionality in
XML documents by defining an
xml:base may be inserted in XML documents to
specify a base URI other than the base URI of the document or external entity, which is
normally used to resolve relative URIs. The value of this attribute is interpreted as
a URI as defined in RFC 2396 [RFC2396].
The base URI specified by
xml:base sets the base URI information set
property of the element on which this attribute occurs, and to its descendants except
xml:base attributes are applied. The value of the
xml:base attribute may itself be a relative URI, in which case it must
itself be resolved against the base URI of the element it appears on. This base URI
may have been obtained from an
xml:base attribute on an ancestor element.
This enables scoping behavior consistent with the
In namespace-aware XML processors, the "xml" prefix is bound to the namespace
http://www.w3.org/XML/1998/namespace as described in XML Namespaces
[XML Names]. Note that
xml:base can be still used by
NOTE: Warning to Implementors: Placing the base attribute in the xml namespace does not leave any room for namespace versioning before this specification becomes a recommendation. Implementors may want to use a different namespace for their prototypes, such as the URI of this Working Draft, until this specification is recognized to be stable.
An example of
xml:base in a simple XHTML document follows.
<?xml version="1.0"?> <html xmlns="http://www.w3.org/TR/xhtml1/strict" xml:base="http://somewhere.org"> <head> <title>Virtual Library</title> </head> <body> <p>See <a href="new.xml">what's new</a>!</p> <p>Check out the hot picks of the day!</p> <ol xml:base="/hotpicks"> <li><a href="pick1.xml">Hot Pick #1</a></li> <li><a href="pick2.xml">Hot Pick #2</a></li> <li><a href="pick3.xml">Hot Pick #3</a></li> </ol> </body> </html>
The URIs in this example resolve to full URIs thus:
Applications resolving URIs appearing in XML documents should resolve these URIs relative
to the base URI as described in RFC 2396 [RFC2396]. The following
describes specifically how RFC 2396 applies to XML documents containing
The base URI is calculated according to the following precedences (highest priority to lowest):
xml:baseattributes in the XML.
NOTE: Steps 2-4 above are a summary of the current behavior of XML 1.0 and the XML Infoset. Step 1 is described in this specification.
Note that the scope of
xml:base does not extend into external entities.
This is in keeping with
The XML Information Set [XML Infoset] exposes an optional base URI property, which
currently is not affected by the presence of
xml:base attributes. This
document specifies an addition to the XML Information Set which integrates the base URI
information set property and the
xml:base attribute. This ensures
that applications that rely on the
xml:base attribute and those that
rely on mechanisms which surface the base URI information set property produce the
The value of the optional base URI property on document information items is not
The value of the optional base URI property on element information items and processing instructions is determined by the rules for resolving relative URIs given above.
In addition to the base URI property, the Infoset should continue to expose
xml:base as an attribute.
xml:basefor the purposes of identification. An update to Namespaces would be needed to fully accomodate xml:base in namespace URIs.
xml:base. The XLink specification requires support for
xml:base. The XHTML specification may want to require support for
xml:basein the interests of interoperability.
uridatatype. Applications recognizing this datatype and resolving such URIs should be aware that when the contents are relative URIs they should be resolved relative to the base URI defined by