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 20 December 1999 first XBase working draft, invites comment on this specification.
The W3C XML Activity believes that a facility of this type is needed soon by a wide variety of XML applications within the W3C and outside.
The W3C Membership and other interested parties are invited to review the specification and report early implementation experience. The purpose of publishing this draft is to solicit feedback from the community both on the need for such a facility and the suitability of the mechanism.
Comments on this document should be sent to the public mailing list firstname.lastname@example.org (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.
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
baseattribute 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>
In 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.
If the base URI is undefined, the URIs are considered erroneous.
Ed. note: What does "erroneous" imply? I just copied it from the HTML spec...
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
NOTE: It is this level of integration with XML 1.0 and the Infoset that drives the desire to use the "xml" namespace.
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.
Issue (xmlbase:system-identifiers): Not being able to affect system identifiers indicates a loss of universal "base" applicability, but this might be undesireable for backwards-compatibility reasons anyway. One way to solve this might be to allow a xml:base psudo-attribute in xml declarations with similar properties as the xml:base attribute.
Issue (xmlbase:namespaces-compatibility): Should Namespaces be extended to take xml:base attributes into account?
xml:base. The XLink specification may want to require support for
xml:basein the interests of interoperability.
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