This document has been produced by the
This document is an Edited Recommendation of the W3C.
It supersedes the previous
Please report errors in this document to the public mailing list
There is no implementation report or test suite for this specification, but
there is a document describing
This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.
This document is governed by the
This document
The XML Linking Language
This document describes a mechanism for providing base URI services to XLink, but
as a modular specification so that other XML applications benefiting from additional
control over relative URIs but not built upon XLink can also make use of it. The
syntax consists of a single XML attribute named
The deployment of XML Base is through normative reference by new
specifications, for example XLink and the XML Infoset. Applications
and specifications built upon these new technologies will natively
support XML Base. The behavior of
This specification does not attempt to specify which text strings in a document are to be interpreted as URIs. That is the responsibility of each XML vocabulary. The question addressed by this specification is: given a relative URI in an XML document, what base URI is it resolved against?
It is expected that a future RFC for XML Media Types will specify XML Base as the mechanism for establishing base URIs in the media types it defines.
The terms
The attribute
In namespace-aware XML processors, the "xml" prefix is bound to the namespace
name http://www.w3.org/XML/1998/namespace
as described in Namespaces in XML
An example of
The URIs in this example resolve to full URIs as follows:
"what's new" resolves to the URI "http://example.org/today/new.xml"
"Hot Pick #1" resolves to the URI "http://example.org/hotpicks/pick1.xml"
"Hot Pick #2" resolves to the URI "http://example.org/hotpicks/pick2.xml"
"Hot Pick #3" resolves to the URI "http://example.org/hotpicks/pick3.xml"
This specification does not give the xml:base attribute any special status as far as XML validity is concerned. In a valid document the attribute must be declared in the DTD, and similar considerations apply to other schema languages.
The set of characters allowed in
The disallowed characters include all non-ASCII characters, plus the
excluded characters listed in Section 2.4 of
Each disallowed character is converted to UTF-8
Any bytes corresponding to a disallowed character are escaped with the URI escaping mechanism (that is, converted to %HH, where HH is the hexadecimal notation of the byte value).
The original character is replaced by the resulting character sequence.
The value of an
In accordance with the principle
that percent-encoding must occur as late as possible in the processing chain,
applications which provide access to the base URI of an element
In the example below, the base URI of element
The base URI is embedded in the document's content.
The base URI is that of the encapsulating entity (message, document, or none).
The base URI is the URI used to retrieve the entity.
The base URI is defined by the context of the application.
The term "entity" in points #2 and #3 above uses the
This document specifies the details of rule #1 for embedding base URI information in the specific case of XML documents.
Relative URIs appearing in an XML document are always resolved relative to either an element, a document entity, or an external entity. There is no provision for finer granularity, such as per-attribute, per-character, or per-entity base information. Neither internal entities, whether declared in the internal subset or in an external DTD, nor freestanding text (text not enclosed in an element) in an external entity, are considered to set a base URI separate from the base URI in scope for the entity reference.
The base URI of a document entity or an external entity is
determined by
The base URI of an element is:
the base URI specified by an
the base URI of the element's parent element within the
document
the base URI of the document entity or external entity containing the element.
It follows that the base URI specified by an
The base URI of an element bearing an
The base URI corresponding to a given relative URI appearing in an XML document is determined as follows:
The base URI for a URI reference appearing in text content is the base URI of the element containing the text.
The base URI for a URI reference appearing in an
The base URI for a URI reference appearing in any other attribute value, including default attribute values, is the base URI of the element bearing the attribute.
The base URI for a URI reference appearing in the content of a processing instruction is the base URI of the parent element of the processing instruction, if one exists within the document entity or external entity, otherwise the base URI of the document entity or external entity containing the processing instruction.
The presence of
The presence of
RFC 3986 defines certain relative URI references, in particular the
empty string and those of the form #fragment
,
as xml:base=""
does not
reset the base URI to that of the containing document.
Some existing processors
An application conforms to XML Base if it calculates base URIs in accordance with the conditions set forth in this specification.
This section has been deleted.
XML Base defines a mechanism for embedding base URI information within an XML document. It does not define a mechanism to recognize which content or attribute values might contain URIs. This is only known by the specifications or applications assigning semantics to the vocabulary.
It is the intention of XML Base that future specifications and revisions of XML vocabularies identify which parts of the XML document are considered to be URIs, and provide normative reference to this specification in order to ensure that relative URIs are treated consistently across XML documents.
The impacts of XML Base on other standards (as of the publication date of this document) are described below.
XML 1.0
The XML Infoset
Namespaces in XML
The XPath
The XSLT
XML Schema Part 2: Datatypes
The XLink
XHTML
The published errata
(see
The definition of URI reference has been switched from RFC2396 to 3986;
The xml:base attribute has been redescribed as a Legacy Extended IRI, but this does not change its syntax (the December 2006 PER used the term "XML Resource Identifier" which was to be defined in an XLink revision, but that plan has been superseded by the definition of LEIRI in the W3C Note);
Implementations are now encouraged to return base “URIs” without escaping non-URI characters;
The meanings of xml:base="" and xml:base="#frag" have been clarified;
The expected reference to XML Base in the forthcoming XML Media Types RFC (“son of 3023”) has been noted;
It has been clarified that normal validity rules apply to the xml:base attribute;
The out-of-date appendix describing effects on other standards has been removed;
Various minor editorial changes have been made.