This document describes the requirements for the XPath 2.0 specification and is annotated with their resolution in [XPath 2.0] or [XQuery 1.0 and XPath 2.0 Functions and Operators] and the [XQuery 1.0 and XPath 2.0 Data Model] specifications.
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 http://www.w3.org/TR/.
This document is the first revision of the [XPath 2.0 Requirements] working draft. This revision includes, for each requirement, a corresponding status, indicating the current situation of the requirement in the XPath 2.0 family of specifications. A future revision will be provided when all remaining open issues have been resolved and when the XPath 2.0 documents are issued as Last Call working drafts.
This is a W3C Working Draft for review by W3C Members and other interested parties. Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
This document has been defined jointly by the XSL Working Group and the XML Query Working Group (both part of the XML Activity).
The XSL Working Group and XML Query Working Group have consensus except in a few specific areas as noted below and the details of these areas are still under active discussion. Nonetheless, we are publishing this draft to encourage early public feedback to the XPath 2.0 requirements process.
Comments on this document should be sent to the W3C mailing list firstname.lastname@example.org (archived at http://lists.w3.org/Archives/Public/public-qt-comments/).
Patent disclosures relevant to this specification may be found on the XSL Working Group's patent disclosure page at http://www.w3.org/Style/XSL/Disclosures.html and the XML Query Working Group's patent disclosure page at http://www.w3.org/2002/08/xmlquery-IPR-statements.
A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR/.
XPath 2.0 has the following goals:
Must Support the XML "Family"
As part of the evolving family of XML standards, XPath 2.0 MUST support the W3C XML architecture by integrating well with other standards in the family.
Must Express Data model in
Terms of the Infoset
XPath 2.0 data model MUST be expressed in terms of the XML Infoset, including Post Schema Validation Infoset contributions. Ideally, XSLT, XPath, and XML Query should share a common data model.
Must Provide Common Core
Syntax and Semantics for XSLT 2.0 and XML Query
XSLT 2.0 contains an expression language which is "XPath 2.0 plus XSLT 2.0 extensions". XML Query 1.0 contains an expression language which we believe should be "XPath 2.0 plus XML Query 1.0 extensions." The scope of XPath 2.0 must be the set of common functionality between the expression language of XSLT 2.0 and the expression language of XML Query 1.0. This will guarantee for Web developers and users that any common functionality are implemented with identical syntax and semantics.
Must Support Explicit "For
Any" or "For All" Comparison and Equality
It MUST be possible for boolean expressions involving node-sets to explicitly use "for any" or "for all" semantics, otherwise known as explicit existential quantification and explicit universal quantification, respectively. Any implicit quantification should be explained in terms of these explicit semantics.
Must Extend Set of
XPath 1.0 currently supports
Satisfied by section 15.3.3 fn:min() and 15.3.4 fn:max() in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Should Maintain Backwards
Compatibility with XPath 1.0
Any valid XPath 1.0 expression SHOULD also be a valid XPath 2.0 expression, and have the same semantics when operating in the absence of XML Schema type information. If not possible to achieve due to other requirements, XPath 2.0 should minimize the number of changes to the XPath 2.0 syntax to maximize backward compatibility with XPath 1.0.
Should Provide Intersection
and Difference Functions
XPath 1.0 supports the union of two node sets. Set functionality in XPath 2.0 SHOULD be expanded to include intersection and difference functions, and should be compatible with equivalent functions supported by XML Query.
Should Support Unary Plus
XML Schema allows decimals to have a leading plus. To align better with this, XPath 2.0 SHOULD allow this by providing a unary plus operator.
Satisfied by section 6.2.7 op:numeric-unary-plus in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Must Improve Ease of
Users of XPath 1.0 have requested enhancements to simplify expression of common XPath use cases. XPath 2.0 MUST address these frequently requested enhancements.
Must Loosen Restrictions on
To better align with XPointer
and to simplify the use of XPath expressions in which
multiple alternatives are allowed for a given location
step, XPath 2.0 MUST relax current restrictions for what
can appear after a '
Must Provide a Conditional
Many users have requested the ability to return a conditional value based on a boolean expression. XPath 2.0 MUST provide a conditional expression which takes three expressions:
and evaluates to expression2 if
Must Define Consistent
Implicit Semantics for Collection-Valued
In XPath 1.0, the use of a collection-valued subexpression can introduce an implicit existential quantification or choose-first-member operation into the containing expression's semantics. XPath 2.0 MUST define a consistent implicit semantics for expressions that have collection-valued subexpressions. This may require that XPath 2.0 expressions use explicit quantification or indexing expressions to achieve the same implicit semantics provided in XPath 1.0.
Satisfied by inclusion of implicit existensial quantification in 3.5.2 General Comparisons in [XPath 2.0]. Note that it is not included in Value Comparisons. The first member semantics were dropped except for Backwards Compatibility mode.
Should Support Additional
Users of XSLT 1.0 have requested additional string manipulation functions. Common requests include string padding (with spaces, dashes, or other characters), string replacement, and converting strings to upper and lower case. XPath 2.0 SHOULD provide additional string functions. As with any string functions, internationalization issues need to be addressed to insure that the functionality is as broadly useful as possible.
Should Simplify String
XPath 1.0 provides the
Satisfied by section 7.5.3 fn:replace in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Should Simplify String
Often string values need to be padded on the left or right to make the value occupy a fixed length. XPath 2.0 SHOULD support a string padding function that permits any character as a padding character.
Satisfied by section 7.4.15 fn:string-pad in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Should Simplify String Case
XPath 2.0 SHOULD provide the ability to convert the case of text to upper or lower case for presentation and/or comparison.
Satisfied by section 7.4.12 fn:upper-case and 7.4.13 fn:lower-case in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Should Support Aggregation
Functions Over Collection-Valued Expressions
Users of XPath 1.0 frequently request the ability to
apply an aggregate function, like
Must Support String Matching
Using Regular Expressions
Regular expressions provide a powerful way to specify string pattern matching and now play an important role in XML Schema as the mechanism by which pattern facets are specified. XPath 2.0 MUST support regular expressions for matching against strings using the regular expression notation established in XML Schema: Datatypes.
Satisfied by section 7.5.1 Regular Expression Syntax in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Must Add Support for XML
Schema Primitive Datatypes
[XML Schema: Datatypes]
defines a set of primitive datatypes. In addition to the
types supported by the XPath 1.0 data model,
Must Define the Operator
Matrix and Conversions
XPath 2.0 MUST support the operators and type-coercion rules defined by the joint XSLT/Schema/Query task force on operators.
Satisfied by sections
Must Allow Scientific
Notation for Numbers
XML Schema specifies a lexical representation for
doubles and floats that includes scientific notation as
Satisfied by section 17.8 Casting to numeric types in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Must Define Appropriate Cast
and Constructor Functions
XPath 2.0 MUST define an appropriate set of functions to allow users to cast and construct instances of XML Schema primitive types. At a minimum, this set MUST include cast and constructor functions for URI and date/time types.
Satisfied by section 17 Casting in [XQuery 1.0 and XPath 2.0 Functions and Operators].
Should Add List Data Type
to the Type System of the Expression
XML Schema allows the definition of simple types derived by list, including lists of unions of non-list simple types. XPath 2.0 SHOULD support an ordered list of simple-typed values.
Must Support Accessing
Simple-Typed Value of Elements and
The XPath 1.0 type system supports the
Must Define Behavior of
Operators for Null Arguments
Since the typed value of an element can be
Should Add Support for XML
XML Schema: Structures enables users to define structured types and associate them to elements in a schema. XPath 2.0 SHOULD provide support for the common operations needed for navigation and selection of typed elements.
Elements/Attributes Based on an Explicit XML Schema
XML Schema : Structures provides the ability to define the type of an element or attribute. XPath 2.0 SHOULD be able to test whether an element or attribute is an instance of a given type.
Elements/Attributes Based on XML Schema Type
XML Schema : Structures provides the ability to define a hierarchy of types by derivation. XPath 2.0 SHOULD be able to selects elements or attributes that are instances of a type, also matching any types derived from it by restriction or extension.
Should Select Elements
Based on XML Schema Substitution Groups
[XML Schema: Datatypes] provides the ability to include two or more element names in a substitution group. XPath 2.0 SHOULD be able to test whether an element is a member of an XML Schema substitution group.
Should Support Lookups
Based on Schema Unique Constraints and Keys
[XML Schema: Datatypes]
supports named, multi-part keys. XPath 2.0 SHOULD support
a mechanism for looking up the element to which a Schema
key refers. Similar mechanisms already exist, such as the
Not Satisfied due to lack of use cases and existing functionality in host languages to create keys.