View Old View New View Both View Only Previous Next

This draft contains only sections that have differences from the version that it modified.

W3C

XQuery and XPath Data Model 4.0

W3C Editor's Draft 23 February 2026

This version:
https://www.w3.org/TR/2000/REC-xpath-datamodel-40-20000101/
Latest version of XQuery and XPath Data Model 4.0:
https://www.w3.org/TR/xpath-datamodel-40/
Previous versions of XQuery and XPath Data Model 4.0:
https://www.w3.org/TR/2017/PR-xpath-datamodel-31-20170117/
https://www.w3.org/TR/2016/CR-xpath-datamodel-31-20161213/
https://www.w3.org/TR/2014/CR-xpath-datamodel-31-20141218/
Most recent version of XQuery and XPath Data Model 4:
https://www.w3.org/TR/xpath-datamodel-4/
Most recent version of XQuery and XPath Data Model:
https://www.w3.org/TR/xpath-datamodel/
Most recent Recommendation of XQuery and XPath Data Model:
https://www.w3.org/TR/2014/REC-xpath-datamodel-30-20140408/
Editors:
Norm Tovey-Walsh, Saxonica, Ltd <norm@saxonica.com>
John Snelson (XML Query WG), MarkLogic Corporation <john.snelson@marklogic.com>
Andrew Coleman (XML Query WG), IBM Hursley Laboratories <andrew_coleman@uk.ibm.com>

Please check the errata for any errors or issues reported since publication.

See also translations.

This document is also available in these non-normative formats: XML.


Abstract

This document defines the XQuery and XPath Data Model 4.0, which is the data model of [XPath 4.0], [XSL Transformations (XSLT) Version 4.0], and [XQuery 4.0: An XML Query Language], and any other specifications that reference it. This document is the result of joint work by the [XSLT Working Group] and the [XML Query Working Group].

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at https://www.w3.org/TR/.

This document is governed by the 1 March 2017 W3C Process Document.

This is a Recommendation of the W3C. It was jointly developed by the W3C XML Query Working Group and the W3C XSLT Working Group, each of which is part of the XML Activity.

This Editor's Draft specifies the XQuery and XPath Data Model (XDM) version 4.0, a fully compatible extension of XDM version 3.1.

This specification is designed to be referenced normatively from other specifications defining a host language for it; it is not intended to be implemented outside a host language. The implementability of this specification has been tested in the context of its normative inclusion in host languages defined by the XQuery 3.1 and XSLT 3.0 specifications; see the XQuery 3.1 implementation report (and, in the future, the WGs expect that there will also be an XSLT 3.0 implementation report) for details.

No substantive changes have been made to this specification since its publication as a Proposed Recommendation.

Please report errors in this document using W3C's public Bugzilla system (instructions can be found at https://www.w3.org/XML/2005/04/qt-bugzilla). If access to that system is not feasible, you may send your comments to the W3C XSLT/XPath/XQuery public comments mailing list, public-qt-comments@w3.org. It will be very helpful if you include the string “[XDM31]” in the subject line of your report, whether made in Bugzilla or in email. Please use multiple Bugzilla entries (or, if necessary, multiple email messages) if you have more than one comment to make. Archives of the comments and responses are available at https://lists.w3.org/Archives/Public/public-qt-comments/.

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 was produced by groups operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures (W3C XML Query Working Group) and a public list of any patent disclosures (W3C XSLT Working Group) made in connection with the deliverables of each group; these pages also include instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Dedication

The publications of this community group are dedicated to our co-chair, Michael Sperberg-McQueen (1954–2024).


7 XML Documents and Nodes

7.3 Base URI

This data model defines a property called Base URI that is associated with a document node and with every element node. In an ideal world, the value of this property will conform with the [XML Base] Recommendation.

Section 7.6.2 base-uri Accessor defines an accessor dm:base-uri representing the Base URI property of a node.

Note:

The Base URI property of a document node that derives from parsing an XML document at some location typically indicates the location from which the document was retrieved. For a document node constructed by a query or stylesheet, it is generally derived from the base URI of the query or stylesheet.

The Base URI property of a document node that derives from parsing an XML document at some location typically indicates the location from which the document was retrieved. For a document node constructed by a query or stylesheet, it is generally derived from the base URI of the query or stylesheet. The base URIbase URI property of element nodes may vary from that of the containing document node: the. The most common reasons for this are (a) that parts of the document may derive from parsing of XML external entities at different locations, and (b) the Base URI property may be explicitly set using an xml:base attribute.

The Base URI property of a document or element node may be absent, indicating that no value for the property is known. This can happen, for example, when a document is constructed by parsing a stream of characters or octets that is not associated with any known location.

In an ideal world, the value of the Base URI property will conform with the [XML Base]It is also possible Recommendation. It is possible, however, that the algorithm defined in [XML Base] for computing a base URI fails to deliver a valid URI. This can arise for various reasons: many software products that construct representations of XML documents are liberal in what they accept; some even pre-date the [XML Base] Recommendation. The [Infoset] Recommendation itself acknowledges the concept of “synthetic infosets” that do not adhere to all defined constraints. Pragmatically, this specification therefore acknowledges the possibility of a third state: the base URI of a document or element node is either a valid URI, or it is absent, or it may be invalid. The accessor dm:base-uri when applied to a node may therefore deliver either a URI, or the special value absent, or it may raise an error indicating that the value is invalid. If the Base URI property of a node is invalid, then operations that depend on the Base URI (the most obvious example being the fn:base-uri function) may raise a dynamic error.