XML Path Language (XPath) 3.1 http://www.w3.org/TR/2014/CR-xpath-31-20141218/ Sorted Definitions Draft

By Patrick Durusau, patrick@durusau.net

Draft version of the sorted definitions for XPath 3.1. The top three (3) entries are paragraphs that became detached from their definitions.

Multiple entries appear for some items where paragraphs were broken apart to give every definition a separate paragraph.


An ordering called document order is defined among all the nodes accessible during processing of a given expression, which may consist of one or more trees (documents or fragments). Document order is defined in [XQuery and XPath Data Model (XDM) 3.1], and its definition is repeated here for convenience. Document order is a total ordering, although the relative order of some nodes is implementation-dependent.XPath 3.1

An ordering called document order is defined among all the nodes accessible during processing of a given expression, which may consist of one or more trees (documents or fragments). Document order is defined in [XQuery and XPath Data Model (XDM) 3.1], and its definition is repeated here for convenience. Document order is a total ordering, although the relative order of some nodes is implementation-dependent.XPath 3.1

Every node has a typed value and a string value, except for nodes whose value is absentDM31. [Definition: The typed value of a node is a sequence of atomic values and can be extracted by applying the fn:data function to the node.]XPath 3.1

[Definition: In the operator mapping tables, the term Gregorian refers to the types xs:gYearMonth, xs:gYear, xs:gMonthDay, xs:gDay, and xs:gMonth.] For binary operators that accept two Gregorian-type operands, both operands must have the same type (for example, if one operand is of type xs:gDay, the other operand must be of type xs:gDay.)XPath 3.1

[Definition: SequenceType matching compares the dynamic type of a value with an expected sequence type. ] For example, an instance of expression returns true if the dynamic type of a given value matches a given sequence type, or false if it does not.XPath 3.1

[Definition: Static Base URI. This is an absolute URI, used to resolve relative URI references. ] If E is a subexpression of F then the Static Base URI of E is the same as the Static Base URI of F. There are no constructs in XPath that require resolution of relative URI references during static analysis. The Static Base URI is available during dynamic evaluation by use of the fn:static-base-uri function, and is used implicitly during dynamic evaluation by functions such as fn:doc. Relative URI references are resolved as described in 2.4.6 Resolving a Relative URI Reference.XPath 3.1

[Definition: Within this specification, the term URI refers to a Universal Resource Identifier as defined in [RFC3986] and extended in [RFC3987] with the new name IRI.] The term URI has been retained in preference to IRI to avoid introducing new names for concepts such as "Base URI" that are defined or referenced across the whole family of XML specifications.XPath 3.1

[Definition: The term XDM instance is used, synonymously with the term value, to denote an unconstrained sequence of items in the data model.]XPath 3.1

[Definition: An XPath 1.0 Processor processes a query according to the XPath 1.0 specification.]XPath 3.1

[Definition: An XPath 1.0 Processor processes a query according to the XPath 1.0 specification.]XPath 3.1

[Definition: An XPath 1.0 Processor processes a query according to the XPath 1.0 specification.]XPath 3.1

[Definition: XPath 1.0 compatibility mode. This value is true if rules for backward compatibility with XPath Version 1.0 are in effect; otherwise it is false. ]XPath 3.1

[Definition: An XPath 2.0 Processor processes a query according to the XPath 2.0 specification.]XPath 3.1

[Definition: An XPath 2.0 Processor processes a query according to the XPath 2.0 specification.]XPath 3.1

[Definition: An XPath 2.0 Processor processes a query according to the XPath 2.0 specification.]XPath 3.1

[Definition: An XPath 3.0 Processor processes a query according to the XPath 3.0 specification.]XPath 3.1

[Definition: An XPath 3.0 Processor processes a query according to the XPath 3.0 specification.]XPath 3.1

[Definition: An XPath 3.0 Processor processes a query according to the XPath 3.0 specification.]XPath 3.1

[Definition: An argument to a function call is either an argument expression or an ArgumentPlaceholder ("?").] If the EQName in a static function call is a lexical QName that has no namespace prefix, it is considered to be in the default function namespace.XPath 3.1

[Definition: An argument to a function call is either an argument expression or an ArgumentPlaceholder ("?").] If the EQName in a static function call is a lexical QName that has no namespace prefix, it is considered to be in the default function namespace.XPath 3.1

[Definition: Argument expressions are evaluated with respect to DC, producing argument values.] The order of argument evaluation is implementation-dependent and a function need not evaluate an argument if the function can evaluate its body without evaluating that argument.XPath 3.1

[Definition: The number of Arguments in an ArgumentList is its arity. ]XPath 3.1

[Definition: An array is a function that associates a set of positions, represented as positive integer keys, with values.] The first position in an array is associated with the integer 1.XPath 3.1

[Definition: An array is a function that associates a set of positions, represented as positive integer keys, with values.] The first position in an array is associated with the integer 1.XPath 3.1

[Definition: An arrow operator is a postfix operator that applies a function to an item, using the item as the first argument to the function.] If $s is a sequence and f() is a function, then $s=>f() is equivalent to f($s), and $s=>f($j) is equivalent to f($s, $j).XPath 3.1

[Definition: The value associated with a given key is called the associated value of the key.]XPath 3.1

[Definition: The value associated with a given key is called the associated value of the key.]XPath 3.1

[Definition: The value associated with a given key is called the associated value of the key.]XPath 3.1

[Definition: An atomic value is a value in the value space of an atomic type, as defined in [XML Schema 1.0] or [XML Schema 1.1].]XPath 3.1

[Definition: An atomic value is a value in the value space of an atomic type, as defined in [XML Schema 1.0] or [XML Schema 1.1].]XPath 3.1

[Definition: An atomic value is a value in the value space of an atomic type, as defined in [XML Schema 1.0] or [XML Schema 1.1].]XPath 3.1

[Definition: An atomic value is a value in the value space of an atomic type, as defined in [XML Schema 1.0] or [XML Schema 1.1].]XPath 3.1

[Definition: An atomic value is a value in the value space of an atomic type, as defined in [XML Schema 1.0] or [XML Schema 1.1].]XPath 3.1

The semantics of some XPath 3.1 operators depend on a process called atomization. Atomization is applied to a value when the value is used in a context in which a sequence of atomic values is required. The result of atomization is either a sequence of atomic values or a type error [err:FOTY0012]. [Definition: Atomization of a sequence is defined as the result of invoking the fn:data function on the sequence, as defined in [XQuery and XPath Functions and Operators 3.1].]XPath 3.1

[Definition: Available documents. This is a mapping of strings to document nodes. Each string represents the absolute URI of a resource. The document node is the root of a tree that represents that resource using the data model. The document node is returned by the fn:doc function when applied to that URI.] The set of available documents is not limited to the set of statically known documents, and it may be empty.XPath 3.1

[Definition: Available node collections. This is a mapping of strings to sequences of nodes. Each string represents the absolute URI of a resource. The sequence of nodes represents the result of the fn:collection function when that URI is supplied as the argument. ] The set of available node collections is not limited to the set of statically known collections, and it may be empty.XPath 3.1

[Definition: Available resource collections. This is a mapping of strings to sequences of URIs. The string represents the absolute URI of a resource which can be interpreted as an aggregation of a number of individual resources each of which has its own URI. The sequence of URIs represents the result of the fn:uri-collection function when that URI is supplied as the argument. ] There is no implication that the URIs in this sequence can be successfully dereferenced, or that the resources they refer to have any particular media type.XPath 3.1

[Definition: Available text resources. This is a mapping of strings to text resources. Each string represents the absolute URI of a resource. The resource is returned by the fn:unparsed-text function when applied to that URI.] The set of available text resources is not limited to the set of statically known documents, and it may be empty.XPath 3.1

[Definition: An axis step returns a sequence of nodes that are reachable from the context node via a specified axis. Such a step has two parts: an axis, which defines the "direction of movement" for the step, and a node test, which selects nodes based on their kind, name, and/or type annotation.] If the context item is a node, an axis step returns a sequence of zero or more nodes; otherwise, a type error is raised [err:XPTY0020]. The resulting node sequence is returned in document order. An axis step may be either a forward step or a reverse step, followed by zero or more predicates.XPath 3.1

[Definition: The built-in functions supported by XPath 3.1 are defined in [XQuery and XPath Functions and Operators 3.1].] Additional functions may be provided in the static context. XPath per se does not provide a way to declare named functions, but a host language may provide such a mechanism.XPath 3.1

[Definition: A collation is a specification of the manner in which strings and URIs are compared and, by extension, ordered. For a more complete definition of collation, see [XQuery and XPath Functions and Operators 3.1].]XPath 3.1

[Definition: A collation is a specification of the manner in which strings and URIs are compared and, by extension, ordered. For a more complete definition of collation, see [XQuery and XPath Functions and Operators 3.1].]XPath 3.1

[Definition: One way to construct a sequence is by using the comma operator, which evaluates each of its operands and concatenates the resulting sequences, in order, into a single result sequence.] Empty parentheses can be used to denote an empty sequence.XPath 3.1

[Definition: The constructor function for a given type is used to convert instances of other atomic types into the given type. The semantics of the constructor function call T($arg) are defined to be equivalent to the expression (($arg) cast as T?).]XPath 3.1

[Definition: The context item is the item currently being processed.]XPath 3.1

[Definition: The context item is the item currently being processed.]XPath 3.1

[Definition: Context item static type. This component defines the static type of the context item within the scope of a given expression.]XPath 3.1

[Definition: When the context item is a node, it can also be referred to as the context node.] The context item is returned by an expression consisting of a single dot (.). When an expression E1/E2 or E1[E2] is evaluated, each item in the sequence obtained by evaluating E1 becomes the context item in the inner focus for an evaluation of E2.XPath 3.1

[Definition: When the context item is a node, it can also be referred to as the context node.] The context item is returned by an expression consisting of a single dot (.). When an expression E1/E2 or E1[E2] is evaluated, each item in the sequence obtained by evaluating E1 becomes the context item in the inner focus for an evaluation of E2.XPath 3.1

[Definition: The context position is the position of the context item within the sequence of items currently being processed.] It changes whenever the context item changes. When the focus is defined, the value of the context position is an integer greater than zero. The context position is returned by the expression fn:position(). When an expression E1/E2 or E1[E2] is evaluated, the context position in the inner focus for an evaluation of E2 is the position of the context item in the sequence obtained by evaluating E1. The position of the first item in a sequence is always 1 (one). The context position is always less than or equal to the context size.XPath 3.1

[Definition: The context size is the number of items in the sequence of items currently being processed.] Its value is always an integer greater than zero. The context size is returned by the expression fn:last(). When an expression E1/E2 or E1[E2] is evaluated, the context size in the inner focus for an evaluation of E2 is the number of items in the sequence obtained by evaluating E1.XPath 3.1

[Definition: Current dateTime. This information represents an implementation-dependent point in time during the processing of an expression, and includes an explicit timezone. It can be retrieved by the fn:current-dateTime function. If invoked multiple times during the execution of an expression, this function always returns the same result.]XPath 3.1

[Definition: XPath 3.1 operates on the abstract, logical structure of an XML document, rather than its surface syntax. This logical structure, known as the data model, is defined in [XQuery and XPath Data Model (XDM) 3.1].]XPath 3.1

[Definition: Default calendar. This is the calendar used when formatting dates in human-readable output (for example, by the functions fn:format-date and fn:format-dateTime) if no other calendar is requested. The value is a string.]XPath 3.1

[Definition: Default collation. This identifies one of the collations in statically known collations as the collation to be used by functions and operators for comparing and ordering values of type xs:string and xs:anyURI (and types derived from them) when no explicit collation is specified.]XPath 3.1

[Definition: Default element/type namespace. This is a namespace URI or absentDM31. The namespace URI, if present, is used for any unprefixed QName appearing in a position where an element or type name is expected.] The URI value is whitespace normalized according to the rules for the xs:anyURI type in [XML Schema 1.0] or [XML Schema 1.1].XPath 3.1

[Definition: Default function namespace. This is a namespace URI or absentDM31. The namespace URI, if present, is used for any unprefixed QName appearing in a position where a function name is expected.] The URI value is whitespace normalized according to the rules for the xs:anyURI type in [XML Schema 1.0] or [XML Schema 1.1].XPath 3.1

[Definition: Default language. This is the natural language used when creating human-readable output (for example, by the functions fn:format-date and fn:format-integer) if no other language is requested. The value is a language code as defined by the type xs:language.]XPath 3.1

[Definition: Default node collection. This is the sequence of nodes that would result from calling the fn:collection function with no arguments.] The value of default collection may be initialized by the implementation.XPath 3.1

[Definition: Default place. This is a geographical location used to identify the place where events happened (or will happen) when formatting dates and times using functions such as fn:format-date and fn:format-dateTime, if no other place is specified. It is used when translating timezone offsets to civil timezone names, and when using calendars where the translation from ISO dates/times to a local representation is dependent on geographical location. Possible representations of this information are an ISO country code or an Olson timezone name, but implementations are free to use other representations from which the above information can be derived.]XPath 3.1

[Definition: Default resource collection. This is the sequence of URIs that would result from calling the fn:uri-collection function with no arguments.] The value of default resource collection may be initialized by the implementation.XPath 3.1

[Definition: Informally, document order is the order in which nodes appear in the XML serialization of a document.]XPath 3.1

[Definition: Informally, document order is the order in which nodes appear in the XML serialization of a document.]XPath 3.1

[Definition: The dynamic context of an expression is defined as information that is available at the time the expression is evaluated.] If evaluation of an expression relies on some part of the dynamic context that is absentDM31, a dynamic error is raised [err:XPDY0002].XPath 3.1

[Definition: A dynamic error is an error that must be detected during the dynamic evaluation phase and may be detected during the static analysis phase. Numeric overflow is an example of a dynamic error . ]XPath 3.1

[Definition: The dynamic evaluation phase is the phase during which the value of an expression is computed.] It occurs after completion of the static analysis phase.XPath 3.1

[Definition: A dynamic function call consists of a base expression that returns the function and a parenthesized list of zero or more arguments (argument expressions or ArgumentPlaceholders).]XPath 3.1

[Definition: A dynamic type is associated with each value as it is computed. The dynamic type of a value may be more specific than the static type of the expression that computed it (for example, the static type of an expression might be xs:integer*, denoting a sequence of zero or more integers, but at evaluation time its value may have the dynamic type xs:integer, denoting exactly one integer.)]XPath 3.1

[Definition: The effective boolean value of a value is defined as the result of applying the fn:boolean function to the value, as defined in [XQuery and XPath Functions and Operators 3.1].]XPath 3.1

[Definition: A sequence containing zero items is called an empty sequence.]XPath 3.1

[Definition: A sequence containing zero items is called an empty sequence.]XPath 3.1

[Definition: Each key / value pair in a map is called an entry.]XPath 3.1

[Definition: Each key / value pair in a map is called an entry.]XPath 3.1

[Definition: Each key / value pair in a map is called an entry.]XPath 3.1

[Definition: Environment variables. This is a mapping from names to values. Both the names and the values are strings. The names are compared using an implementation-defined collation, and are unique under this collation. The set of environment variables is implementation-defined and may be empty.]XPath 3.1

[Definition: In addition to its identifying QName, a dynamic error may also carry a descriptive string and one or more additional values called error values.] An implementation may provide a mechanism whereby an application-defined error handler can process error values and produce diagnostic messages. XQuery 3.1 provides standard error handling via Section 3.16 Try/Catch Expressions XQ31 .XPath 3.1

[Definition: An expanded QName consists of an optional namespace URI and a local name. An expanded QName also retains its original namespace prefix (if any), to facilitate casting the expanded QName into a string.] Two expanded QNames are equal if their namespace URIs are equal and their local names are equal (even if their namespace prefixes are not equal). Namespace URIs and local names are compared on a codepoint basis, without further normalization.XPath 3.1

[Definition: The expression context for a given expression consists of all the information that can affect the result of the expression.]XPath 3.1

[Definition: An expression followed by a predicate (that is, E1[E2]) is referred to as a filter expression: its effect is to return those items from the value of E1 that satisfy the predicate in E2.] Filter expressions are described in 3.2.1 Filter ExpressionsXPath 3.1

[Definition: In a partial function application, a fixed position is an argument/parameter position for which the ArgumentList has an argument expression (as opposed to an ArgumentPlaceholder). ] (Note that a partial function application need not have any fixed positions.)XPath 3.1

[Definition: The first three components of the dynamic context (context item, context position, and context size) are called the focus of the expression. ] The focus enables the processor to keep track of which items are being processed by the expression. If any component in the focus is defined, all components of the focus are defined.XPath 3.1

[Definition: The first three components of the dynamic context (context item, context position, and context size) are called the focus of the expression. ] The focus enables the processor to keep track of which items are being processed by the expression. If any component in the focus is defined, all components of the focus are defined.XPath 3.1

[Definition: Function coercion wraps a functionDM31 in a new function with signature the same as the expected type. This effectively delays the checking of the argument and return types until the function is invoked.]XPath 3.1

[Definition: The function conversion rules are used to convert an argument value to its expected type; that is, to the declared type of the function parameter. ] The expected type is expressed as a sequence type. The function conversion rules are applied to a given value as follows:XPath 3.1

[Definition: A generalized atomic type is a type which is either (a) an atomic type or (b) a pure union type ].XPath 3.1

[Definition: Implementation-defined indicates an aspect that may differ between implementations, but must be specified by the implementor for each particular implementation.]XPath 3.1

[Definition: Implementation-dependent indicates an aspect that may differ between implementations, is not specified by this or any W3C specification, and is not required to be specified by the implementor for any particular implementation.]XPath 3.1

[Definition: Implicit timezone. This is the timezone to be used when a date, time, or dateTime value that does not have a timezone is used in a comparison or arithmetic operation. The implicit timezone is an implementation-defined value of type xs:dayTimeDuration. See [XML Schema 1.0] or [XML Schema 1.1] for the range of valid values of a timezone.]XPath 3.1

[Definition: In-scope attribute declarations. Each attribute declaration is identified either by an expanded QName (for a top-level attribute declaration) or by an implementation-dependent attribute identifier (for a local attribute declaration). ]XPath 3.1

[Definition: In-scope element declarations. Each element declaration is identified either by an expanded QName (for a top-level element declaration) or by an implementation-dependent element identifier (for a local element declaration). ] An element declaration includes information about the element's substitution group affiliation.XPath 3.1

Element nodes have a property called in-scope namespaces. [Definition: The in-scope namespaces property of an element node is a set of namespace bindings, each of which associates a namespace prefix with a URI.] For a given element, one namespace binding may have an empty prefix; the URI of this namespace binding is the default namespace within the scope of the element.XPath 3.1

[Definition: In-scope schema definitions. This is a generic term for all the element declarations, attribute declarations, and schema type definitions that are in scope during static analysis of an expression.] It includes the following three parts:XPath 3.1

[Definition: In-scope schema types. Each schema type definition is identified either by an expanded QName (for a named type) or by an implementation-dependent type identifier (for an anonymous type). The in-scope schema types include the predefined schema types described in 2.5.1 Predefined Schema Types. ]XPath 3.1

[Definition: In-scope variables. This is a mapping from expanded QName to type. It defines the set of variables that are available for reference within an expression. The expanded QName is the name of the variable, and the type is the static type of the variable.]XPath 3.1

[Definition: The initial context item is a context item that an implementation can set before processing a query begins. The query body and the prolog of every module in a query share the same initial context item.]XPath 3.1

[Definition: An inline function expression creates an anonymous functionDM31 defined directly in the inline function expression itself.] An inline function expression specifies the names and SequenceTypes of the parameters to the function, the SequenceType of the result, and the body of the function.XPath 3.1

[Definition: An item is either an atomic value, a node, or a functionDM31.]XPath 3.1

[Definition: An item is either an atomic value, a node, or a functionDM31.]XPath 3.1

[Definition: An item is either an atomic value, a node, or a functionDM31.]XPath 3.1

[Definition: An item is either an atomic value, a node, or a functionDM31.]XPath 3.1

[Definition: An item is either an atomic value, a node, or a functionDM31.]XPath 3.1

[Definition: An alternative form of a node test called a kind test can select nodes based on their kind, name, and type annotation.] The syntax and semantics of a kind test are described in 2.5.4 SequenceType Syntax and 2.5.5 SequenceType Matching. When a kind test is used in a node test, only those nodes on the designated axis that match the kind test are selected. Shown below are several examples of kind tests that might be used in path expressions:XPath 3.1

[Definition: A lexical QName is a name that conforms to the syntax of [http://www.w3.org/TR/REC-xml-names/#NT-QName].] A lexical QName consists of an optional namespace prefix and a local name. If the namespace prefix is present, it is separated from the local name by a colon. A lexical QName with a prefix can be converted into an expanded QName by resolving its namespace prefix to a namespace URI, using the statically known namespaces. The semantics of a lexical QName without a prefix depend on the expression in which it is found.XPath 3.1

[Definition: A literal is a direct syntactic representation of an atomic value.] XPath 3.1 supports two kinds of literals: numeric literals and string literals.XPath 3.1

[Definition: A map is a function that associates a set of keys with values, resulting in a collection of key / value pairs.]XPath 3.1

[Definition: A map is a function that associates a set of keys with values, resulting in a collection of key / value pairs.]XPath 3.1

[Definition: A map is a function that associates a set of keys with values, resulting in a collection of key / value pairs.]XPath 3.1

[Definition: The values of an array are called its members.] In the type hierarchy, array has a distinct type, which is derived from function. Atomization converts arrays to sequences (see Atomization).XPath 3.1

[Definition: The values of an array are called its members.] In the type hierarchy, array has a distinct type, which is derived from function. Atomization converts arrays to sequences (see Atomization).XPath 3.1

[Definition: A node test that consists only of an EQName or a Wildcard is called a name test.] A name test is true if and only if the kind of the node is the principal node kind for the step axis and the expanded QName of the node is equal (as defined by the eq operator) to the expanded QName specified by the name test. For example, child::para selects the para element children of the context node; if the context node has no para children, it selects an empty set of nodes. attribute::abc:href selects the attribute of the context node with the QName abc:href; if the context node has no such attribute, it selects an empty set of nodes.XPath 3.1

[Definition: A named function is a function defined in the static context for the expression. To uniquely identify a particular named function, both its name as an expanded QName and its arity are required.]XPath 3.1

[Definition: A named function is a function defined in the static context for the expression. To uniquely identify a particular named function, both its name as an expanded QName and its arity are required.]XPath 3.1

[Definition: A named function reference denotes a named function.]XPath 3.1

[Definition: A named function reference denotes a named function.]XPath 3.1

[Definition: Named functions. This is a mapping from (expanded QName, arity) to functionDM31. ] It supplies a function for each signature in statically known function signatures and may supply other functions (see 2.2.4 Consistency Constraints). Named functions can include functions with implementation-dependent implementations; these functions do not have a static context or a dynamic context of their own.XPath 3.1

[Definition: The namespace-sensitive types are xs:QName, xs:NOTATION, types derived by restriction from xs:QName or xs:NOTATION, list types that have a namespace-sensitive item type, and union types with a namespace-sensitive type in their transitive membership.]XPath 3.1

[Definition: A node is an instance of one of the node kinds defined in [XQuery and XPath Data Model (XDM) 3.1].] Each node has a unique node identity, a typed value, and a string value. In addition, some nodes have a name. The typed value of a node is a sequence of zero or more atomic values. The string value of a node is a value of type xs:string. The name of a node is a value of type xs:QName.XPath 3.1

[Definition: A node is an instance of one of the node kinds defined in [XQuery and XPath Data Model (XDM) 3.1].] Each node has a unique node identity, a typed value, and a string value. In addition, some nodes have a name. The typed value of a node is a sequence of zero or more atomic values. The string value of a node is a value of type xs:string. The name of a node is a value of type xs:QName.XPath 3.1

[Definition: A node is an instance of one of the node kinds defined in [XQuery and XPath Data Model (XDM) 3.1].] Each node has a unique node identity, a typed value, and a string value. In addition, some nodes have a name. The typed value of a node is a sequence of zero or more atomic values. The string value of a node is a value of type xs:string. The name of a node is a value of type xs:QName.XPath 3.1

[Definition: A node is an instance of one of the node kinds defined in [XQuery and XPath Data Model (XDM) 3.1].] Each node has a unique node identity, a typed value, and a string value. In addition, some nodes have a name. The typed value of a node is a sequence of zero or more atomic values. The string value of a node is a value of type xs:string. The name of a node is a value of type xs:QName.XPath 3.1

[Definition: A node is an instance of one of the node kinds defined in [XQuery and XPath Data Model (XDM) 3.1].] Each node has a unique node identity, a typed value, and a string value. In addition, some nodes have a name. The typed value of a node is a sequence of zero or more atomic values. The string value of a node is a value of type xs:string. The name of a node is a value of type xs:QName.XPath 3.1

[Definition: A node test is a condition on the name, kind (element, attribute, text, document, comment, or processing instruction), and/or type annotation of a node. A node test determines which nodes contained by an axis are selected by a step.]XPath 3.1

[Definition: When referring to a type, the term numeric denotes the types xs:integer, xs:decimal, xs:float, and xs:double which are all member types of the built-in union type xs:numeric .] An operator whose operands and result are designated as numeric might be thought of as representing four operators, one for each of the numeric types. For example, the numeric + operator might be thought of as representing the following four operators:XPath 3.1

The operator mapping tables in this section list the combinations of types for which the various operators of XPath 3.1 are defined. [Definition: For each operator and valid combination of operand types, the operator mapping tables specify a result type and an operator function that implements the semantics of the operator for the given types.] The definitions of the operator functions are given in [XQuery and XPath Functions and Operators 3.1]. The result of an operator may be the raising of an error by its operator function, as defined in [XQuery and XPath Functions and Operators 3.1]. In some cases, the operator function does not implement the full semantics of a given operator. For the definition of each operator (including its behavior for empty sequences or sequences of length greater than one), see the descriptive material in the main part of this document.XPath 3.1

[Definition: A static or dynamic function call is a partial function application if one or more arguments is an ArgumentPlaceholder. ]XPath 3.1

[Definition: A path expression can be used to locate nodes within trees. A path expression consists of a series of one or more steps, separated by "/" or "//", and optionally beginning with "/" or "//".] An initial "/" or "//" is an abbreviation for one or more initial steps that are implicitly added to the beginning of the path expression, as described below.XPath 3.1

[Definition: Primary expressions are the basic primitives of the language. They include literals, variable references, context item expressions, and function calls. A primary expression may also be created by enclosing any expression in parentheses, which is sometimes helpful in controlling the precedence of operators.] Map and Array Constructors are described in 3.11 Maps and Arrays.XPath 3.1

[Definition: Every axis has a principal node kind. If an axis can contain elements, then the principal node kind is element; otherwise, it is the kind of nodes that the axis can contain.] Thus:XPath 3.1

[Definition: A pure union type is an XML Schema union type that satisfies the following constraints: (1) {variety} is union, (2) the {facets} property is empty, (3) no type in the transitive membership of the union type has {variety} list, and (4) no type in the transitive membership of the union type is a type with {variety} union having a non-empty {facets} property].XPath 3.1

[Definition: To resolve a relative URI $rel against a base URI $base is to expand it to an absolute URI, as if by calling the function fn:resolve-uri($rel, $base).] During static analysis, the base URI is the Static Base URI. During dynamic evaluation, the base URI used to resolve a relative URI reference depends on the semantics of the expression.XPath 3.1

[Definition: The node ordering that is the reverse of document order is called reverse document order.]XPath 3.1

[Definition: Two atomic values K1 and K2 have the same key value if the relation deep-equal(K1, K2, $UCC) holds, where $UCC is the Unicode codepoint collation.] If two or more entries have the same key value then a dynamic error is raised [err:XQDY0137].XPath 3.1

[Definition: A schema type is a type that is (or could be) defined using the facilities of [XML Schema 1.0] or [XML Schema 1.1] (including the built-in types of [XML Schema 1.0] or [XML Schema 1.1]).] A schema type can be used as a type annotation on an element or attribute node (unless it is a non-instantiable type such as xs:NOTATION or xs:anyAtomicType, in which case its derived types can be so used). Every schema type is either a complex type or a simple type; simple types are further subdivided into list types, union types, and atomic types (see [XML Schema 1.0] or [XML Schema 1.1] for definitions and explanations of these terms.)XPath 3.1

[Definition: A sequence is an ordered collection of zero or more items.]XPath 3.1

[Definition: A sequence is an ordered collection of zero or more items.]XPath 3.1

[Definition: A sequence is an ordered collection of zero or more items.]XPath 3.1

[Definition: A sequence is an ordered collection of zero or more items.]XPath 3.1

[Definition: A sequence is an ordered collection of zero or more items.]XPath 3.1

[Definition: A sequence type is a type that can be expressed using the SequenceType syntax. Sequence types are used whenever it is necessary to refer to a type in an XPath 3.1 expression. The term sequence type suggests that this syntax is used to describe the type of an XPath 3.1 value, which is always a sequence.]XPath 3.1

[Definition: A sequence containing exactly one item is called a singleton.] An item is identical to a singleton sequence containing that item. Sequences are never nested—for example, combining the values 1, (2, 3), and ( ) into a single sequence results in the sequence (1, 2, 3).XPath 3.1

[Definition: A sequence containing exactly one item is called a singleton.] An item is identical to a singleton sequence containing that item. Sequences are never nested—for example, combining the values 1, (2, 3), and ( ) into a single sequence results in the sequence (1, 2, 3).XPath 3.1

If the value of the predicate expression is a singleton atomic value of a numeric type or derived from a numeric type, the predicate truth value is true if the value of the predicate expression is equal (by the eq operator) to the context position, and is false otherwise. [Definition: A predicate whose predicate expression returns a numeric type is called a numeric predicate.]XPath 3.1

[Definition: A singleton focus is a focus that refers to a single item; in a singleton focus, context item is set to the item, context position = 1 and context size = 1.]XPath 3.1

[Definition: A singleton focus is a focus that refers to a single item; in a singleton focus, context item is set to the item, context position = 1 and context size = 1.]XPath 3.1

[Definition: Document order is stable, which means that the relative order of two nodes will not change during the processing of a given expression, even if this order is implementation-dependent.]XPath 3.1

[Definition: Document order is stable, which means that the relative order of two nodes will not change during the processing of a given expression, even if this order is implementation-dependent.] [Definition: The node ordering that is the reverse of document order is called reverse document order.]XPath 3.1

[Definition: The static analysis phase depends on the expression itself and on the static context. The static analysis phase does not depend on input data (other than schemas).]XPath 3.1

During the static analysis phase, a processor may perform type analysis. The effect of type analysis is to assign a static type to each expression in the operation tree.XPath 3.1

[Definition: The static context of an expression is the information that is available during static analysis of the expression, prior to its evaluation.] This information can be used to decide whether the expression contains a static error.XPath 3.1

[Definition: An error that can be detected during the static analysis phase, and is not a type error, is a static error.] A syntax error is an example of a static error.XPath 3.1

[Definition: A static function call consists of an EQName followed by a parenthesized list of zero or more arguments.]XPath 3.1

[Definition: A static function call consists of an EQName followed by a parenthesized list of zero or more arguments.]XPath 3.1

[Definition: The static type of an expression is the best inference that the processor is able to make statically about the type of the result of the expression.] This specification does not define the rules for type analysis nor the static types that are assigned to particular expressions: the only constraint is that the inferred type must match all possible values that the expression is capable of returning.XPath 3.1

[Definition: The Static Typing Feature is an optional feature of XPath that provides support for static semantics, and requires implementations to detect and report type errors during the static analysis phase.] Specifications that use XPath may specify conformance criteria for use of the Static Typing Feature.XPath 3.1

[Definition: Statically known collations. This is an implementation-defined mapping from URI to collation. It defines the names of the collations that are available for use in processing expressions.]XPath 3.1

[Definition: Statically known collations. This is an implementation-defined mapping from URI to collation. It defines the names of the collations that are available for use in processing expressions.]XPath 3.1

[Definition: Statically known collections. This is a mapping from strings to types. The string represents the absolute URI of a resource that is potentially available using the fn:collection function. The type is the type of the sequence of nodes that would result from calling the fn:collection function with this URI as its argument.] If the argument to fn:collection is a string literal that is not present in statically known collections, then the static type of fn:collection is node()*.XPath 3.1

[Definition: Statically known decimal formats. This is a mapping from QName to decimal format, with one default format that has no visible name. Each format is used for serializing decimal numbers using fn:format-number().]XPath 3.1

[Definition: Statically known default collection type. This is the type of the sequence of nodes that would result from calling the fn:collection function with no arguments.] Unless initialized to some other value by an implementation, the value of statically known default collection type is node()*.XPath 3.1

[Definition: Statically known documents. This is a mapping from strings to types. The string represents the absolute URI of a resource that is potentially available using the fn:doc function. The type is the static type of a call to fn:doc with the given URI as its literal argument. ] If the argument to fn:doc is a string literal that is not present in statically known documents, then the static type of fn:doc is document-node()?.XPath 3.1

[Definition: Statically known function signatures. This is a mapping from (expanded QName, arity) to function signatureDM31. ] The entries in this mapping define the set of statically known functions — those functions that are available to be called from a static function call, or referenced from a named function reference. Each such function is uniquely identified by its expanded QName and arity (number of parameters). Given a statically known function's expanded QName and arity, this component supplies the function's signatureDM31, which specifies various static properties of the function, including types.XPath 3.1

[Definition: Statically known namespaces. This is a mapping from prefix to namespace URI that defines all the namespaces that are known during static processing of a given expression.] The URI value is whitespace normalized according to the rules for the xs:anyURI type in [XML Schema 1.0] or [XML Schema 1.1]. Note the difference between in-scope namespaces, which is a dynamic property of an element node, and statically known namespaces, which is a static property of an expression.XPath 3.1

[Definition: A step is a part of a path expression that generates a sequence of items and then filters the sequence by zero or more predicates. The value of the step consists of those items that satisfy the predicates, working from left to right. A step may be either an axis step or a postfix expression.] Postfix expressions are described in 3.2 Postfix Expressions.XPath 3.1

[Definition: The string value of a node is a string and can be extracted by applying the fn:string function to the node.] Definitions of fn:data and fn:string can be found in [XQuery and XPath Functions and Operators 3.1].XPath 3.1

[Definition: The string value of a node is a string and can be extracted by applying the fn:string function to the node.] Definitions of fn:data and fn:string can be found in [XQuery and XPath Functions and Operators 3.1].XPath 3.1

[Definition: Substitution groups are defined in [XML Schema 1.0] and [XML Schema 1.1] Part 1. Informally, the substitution group headed by a given element (called the head element) consists of the set of elements that can be substituted for the head element without affecting the outcome of schema validation.]XPath 3.1

[Definition: A sequence type A is a subtype of a sequence type B if the judgement subtype(A, B) is true.] When the judgement subtype(A, B) is true, it is always the case that for any value V, (V instance of A) implies (V instance of B).XPath 3.1

[Definition: The use of a value whose dynamic type is derived from an expected type is known as subtype substitution.] Subtype substitution does not change the actual type of a value. For example, if an xs:integer value is used where an xs:decimal value is expected, the value retains its type as xs:integer.XPath 3.1

[Definition: Each element node and attribute node in an XDM instance has a type annotation (described in [XQuery and XPath Data Model (XDM) 3.1]). The type annotation of a node is a reference to an XML Schema type. ] The type-name of a node is the name of the type referenced by its type annotation. If the XDM instance was derived from a validated XML document as described in Section 3.3 Construction from a PSVI DM31, the type annotations of the element and attribute nodes are derived from schema validation. XPath 3.1 does not provide a way to directly access the type annotation of an element or attribute node.XPath 3.1

[Definition: A type error may be raised during the static analysis phase or the dynamic evaluation phase. During the static analysis phase, a type error occurs when the static type of an expression does not match the expected type of the context in which the expression occurs. During the dynamic evaluation phase, a type error occurs when the dynamic type of a value does not match the expected type of the context in which the value occurs.]XPath 3.1

[Definition: Under certain circumstances, an atomic value can be promoted from one type to another. Type promotion is used in evaluating function calls (see 3.1.5.1 Evaluating Static and Dynamic Function Calls) and operators that accept numeric or string operands (see B.2 Operator Mapping).] The following type promotions are permitted:XPath 3.1

[Definition: The typed value of a node is a sequence of atomic values and can be extracted by applying the fn:data function to the node.]XPath 3.1

[Definition: In the data model, a value is always a sequence.]XPath 3.1

[Definition: In the data model, a value is always a sequence.]XPath 3.1

[Definition: In the data model, a value is always a sequence.]XPath 3.1

[Definition: In the data model, a value is always a sequence.]XPath 3.1

[Definition: In the data model, a value is always a sequence.]XPath 3.1

[Definition: A variable reference is an EQName preceded by a $-sign.] An unprefixed variable reference is in no namespace. Two variable references are equivalent if their expanded QNames are equal (as defined by the eq operator). The scope of a variable binding is defined separately for each kind of expression that can bind variables.XPath 3.1

[Definition: Variable values. This is a mapping from expanded QName to value. It contains the same expanded QNames as the in-scope variables in the static context for the expression. The expanded QName is the name of the variable and the value is the dynamic value of the variable, which includes its dynamic type.]XPath 3.1

[Definition: In addition to static errors, dynamic errors, and type errors, an XPath 3.1 implementation may raise warnings, either during the static analysis phase or the dynamic evaluation phase. The circumstances in which warnings are raised, and the ways in which warnings are handled, are implementation-defined.]XPath 3.1

[Definition: xs:anyAtomicType is an atomic type that includes all atomic values (and no values that are not atomic). Its base type is xs:anySimpleType from which all simple types, including atomic, list, and union types, are derived. All primitive atomic types, such as xs:decimal and xs:string, have xs:anyAtomicType as their base type.]XPath 3.1

[Definition: xs:dayTimeDuration is derived by restriction from xs:duration. The lexical representation of xs:dayTimeDuration is restricted to contain only day, hour, minute, and second components.]XPath 3.1

[Definition: xs:error is a simple type with no value space, defined in [XML Schema 1.1]. In implementations that support XML Schema 1.1, it can be used in the 2.5.4 SequenceTypeSyntax to raise errors.]XPath 3.1

[Definition: xs:untyped is used as the type annotation of an element node that has not been validated, or has been validated in skip mode.] No predefined schema types are derived from xs:untyped.XPath 3.1

[Definition: xs:untypedAtomic is an atomic type that is used to denote untyped atomic data, such as text that has not been assigned a more specific type.] An attribute that has been validated in skip mode is represented in the data model by an attribute node with the type annotation xs:untypedAtomic. No predefined schema types are derived from xs:untypedAtomic.XPath 3.1

[Definition: xs:yearMonthDuration is derived by restriction from xs:duration. The lexical representation of xs:yearMonthDuration is restricted to contain only year and month components.]XPath 3.1


Errors or comments to:patrick@durusau.net

Creative Commons License
XML Path Language (XPath) 3.1 http://www.w3.org/TR/2014/CR-xpath-31-20141218/ Sorted Definitions Draft by Patrick Durusau is licensed under a Creative Commons Attribution 4.0 International License.