An EnumerationType accepts a fixed set of string values.
In the operator mapping tables,
the term Gregorian refers to the types
xs:gYearMonth
, xs:gYear
,
xs:gMonthDay
, xs:gDay
, and
xs:gMonth
.
NaN is the string used to represent the double value NaN (not-a-number); the default value is the string "NaN"
SequenceType matching compares a value with an expected sequence type.
Static Base URI. This is an absolute URI, used to resolve relative URI references.
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 XDM instance is used, synonymously with the term value, to denote an unconstrained sequence of items.
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
.
An anonymous function is a function item with no name. Anonymous functions may be created, for example, by evaluating an inline function expression or by partial function application.
An argument to a function call is either an
argument expression or an ArgumentPlaceholder
(?
); in both cases it may
either be supplied positionally, or identified by a name (called a keyword).
A function definition has an arity range, which is a range of consecutive non-negative integers. If the function definition has M required parameters and N optional parameters, then its arity range is from M to M+N inclusive.
An array is a function item that associates a set of positions, represented as positive integer keys, with values.
An arrow operator applies a function to the value of an expression, using the value as the first argument to the function.
The value associated with a given key is called the associated value of the key.
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].
Atomization of a sequence
is defined as the result of invoking the fn:data
function, as defined in Section
2.4 fn:data
FO31.
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.
Available
collections. This is a mapping of
strings to sequences of items. Each string
represents the absolute URI of a
resource. The sequence of items represents
the result of the fn:collection
function when that URI is supplied as the
argument.
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.
Available
URI 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.
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.
Built-in functions are function definitions that are always present in the static context by virtue of rules in the host language; they will typically include the functions specified in [XQuery and XPath Functions and Operators 4.0].
The coercion rules are rules used to convert a supplied value to a required type, for example when converting an argument of a function call to the declared type of the function parameter.
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 Section 5.3 Comparison of strings FO31.
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.
The constructor function for a given type is used to convert instances of other simple 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?)
.
In an enclosed expression, the optional expression enclosed in curly braces is called the content expression.
The context item is the item currently being processed.
Context item static type. This component defines the static type of the context item within the scope of a given expression.
When the context item is a node, it can also be referred to as the context node.
The context position is the position of the context item within the sequence of items currently being processed.
The context size is the number of items in the sequence of items currently being processed.
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 called multiple times during the execution of
an expression,
this function always returns the same result.
XPath 4.0 operates on the abstract, logical structure of an XML document or JSON object, rather than its surface syntax. This logical structure, known as the data model, is defined in [XQuery and XPath Data Model (XDM) 3.1].
decimal-separator is the character used to separate the integer part of the number from the fractional part, both in the picture string and in the formatted number; the default value is the period character (.)
Default URI collection.
This is the sequence of URIs that would result from calling the fn:uri-collection
function
with no arguments.
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.
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.
Default collection.
This is the sequence of items that would result from calling the fn:collection
function
with no arguments.
Default element 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 name is expected.
Default function namespace. This is either 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.
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
.
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.
Default 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 a type name is expected.
The delimiting terminal symbols are: "!", "!!", "!=", StringLiteral, "#", "$", "(", ")", "*", "*:", "+", (comma), "-", "->", (dot), "..", "/", "//", (colon), ":*", "::", ":=", "<", "<<", "<=", "=", "=>", ">", ">=", ">>", "?", "??", "@", BracedURILiteral, "[", "]", "{", "|", "||", "}"
digit is a character used in the picture string to represent an optional digit; the default value is the number sign character (#)
Informally, document order is the order in which nodes appear in the XML serialization of a document.
The dynamic context of an expression is defined as information that is needed for the dynamic evaluation of an expression.
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.
The dynamic evaluation phase is the phase during which the value of an expression is computed.
A dynamic function call is an expression that is evaluated by calling a function item, which is typically obtained dynamically.
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).
Every value matches one or more sequence types. A value is said to have a dynamic type T if it matches (or is an instance of) the sequence type T.
Dynamically known function definitions. This is a set of function definitions. It includes the statically known function definitions as a subset, but may include other function definitions that are not known statically.
The
effective boolean value of a value is defined as the result
of applying the fn:boolean
function to the value, as
defined in Section
7.3.1 fn:boolean
FO31.
A sequence containing zero items is called an empty sequence.
An enclosed expression is an instance of the EnclosedExpr production, which allows an optional expression within curly braces.
Each key / value pair in a map is called an entry.
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.
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 expanded QName is a triple: its components are a prefix, a local name, and a namespace URI. In the case of a name in no namespace, the namespace URI and prefix are both absent. In the case of a name in the default namespace, the prefix is absent.
exponent-separator is the character used to separate the mantissa from the exponent in scientific notation both in the picture string and in the formatted number; the default value is the character (e).
The expression context for a given expression consists of all the information that can affect the result of the expression.
External functions are functions that are implemented outside the query environment.
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.
In a partial function application, a supplied parameter
is any parameter other than one for which the ArgumentList
includes
a placeholder.
The first three components of the dynamic context (context item, context position, and context size) are called the focus of the expression.
Function coercion wraps a function item in a new function whose signature is the same as the expected type. This effectively delays the checking of the argument and return types until the function is called.
A function definition contains information used to evaluate a static function call, including the name, parameters, and return type of the function.
A function item is an item that can be called using a dynamic function call.
A generalized atomic type is a schema-defined type which is either (a) an atomic type or (b) a pure union type
grouping-separator is the character typically used as a thousands separator, both in the picture string and in the formatted number; the default value is the comma character (,)
An expression E is said to be guarded by some governing condition C if evaluation of E is not allowed to fail with a dynamic error except when C applies.
A host language for XPath is a language or specification that incorporates XPath as a sublanguage and that defines how the static and dynamic context for evaluation of XPath expressions are to be established.
Ignorable whitespace consists of any whitespace characters that may occur between terminals, unless these characters occur in the context of a production marked with a ws:explicit annotation, in which case they can occur only where explicitly specified (see A.2.4.2 Explicit Whitespace Handling).
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.
Implementation-defined indicates an aspect that may differ between implementations, but must be specified by the implementor for each particular implementation.
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 Section
3.2.7.3 Timezones
XS1-2 or
Section
3.3.7 dateTime
XS11-2 for the range of valid values of a timezone.
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).
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).
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.
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.
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 3.1 Predefined Schema Types.
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.
infinity is the string used to represent the double value infinity (INF
); the
default value is the string "Infinity"
An inline function expression creates an anonymous function defined directly in the inline function expression.
An item is either an atomic value, a node, or a function item.
An item type is a type that can be expressed using the ItemType syntax, which forms part of the SequenceType syntax. Item types match individual items.
Item type aliases. This is a mapping from
expanded QName to ItemTypes
.
An alternative form of a node test called a kind test can select nodes based on their kind, name, and type annotation.
A lexical QName is a name that conforms to the syntax of the QName production
A literal is a direct syntactic representation of an atomic value.
A map is a function that associates a set of keys with values, resulting in a collection of key / value pairs.
MAY means that an item is truly optional.
The values of an array are called its members.
minus-sign is the single character used to mark negative numbers; the default value is the hyphen-minus character (#x2D).
MUST means that the item is an absolute requirement of the specification.
MUST NOT means that the item is an absolute prohibition of the specification.
A node test that consists only of an EQName or a Wildcard is called a name test.
A named function reference is an expression (written name#arity
)
which evaluates to a function item.
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.
A node is an instance of one of the node kinds defined in Section 6 Nodes DM31.
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.
The non-delimiting terminal symbols are: IntegerLiteral, URIQualifiedName, NCName, DecimalLiteral, DoubleLiteral, QName, "ancestor", "ancestor-or-self", "and", "array", "as", "attribute", "cast", "castable", "child", "comment", "descendant", "descendant-or-self", "div", "document-node", "element", "else", "empty-sequence", "enum", "eq", "every", "except", "following", "following-sibling", "for", "function", "ge", "gt", "idiv", "if", "in", "instance", "intersect", "is", "item", "le", "let", "lt", "map", "member", "mod", "namespace", "namespace-node", "ne", "node", "of", "or", "otherwise", "parent", "preceding", "preceding-sibling", "processing-instruction", "record", "return", "satisfies", "schema-attribute", "schema-element", "self", "some", "text", "then", "to", "treat", "union", "with"
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
.
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.
A static or dynamic function call is a partial function application if one or more arguments is an ArgumentPlaceholder.
A partially applied function is a function created by partial function application.
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 "//
".
pattern-separator is a character used to separate positive and negative sub-pictures in a picture string; the default value is the semi-colon character (;)
per-mille is the character used both in the picture string and in the formatted number to indicate that the number is written as a per-thousand fraction; the default value is the Unicode per-mille character (#x2030)
percent is the character used both in the picture string and in the formatted number to indicate that the number is written as a per-hundred fraction; the default value is the percent character (%)
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.
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.
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
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)
.
The node ordering that is the reverse of document order is called reverse document order.
Two atomic values K1
and
K2
have the same key value if
op:same-key(K1, K2)
returns true
, as specified in Section
17.1.1 op:same-key
FO31
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).
A sequence is an ordered collection of zero or more items.
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 4.0 expression. The term sequence type suggests that this syntax is used to describe the type of an XPath 4.0 value, which is always a sequence.
A sequence containing exactly one item is called a singleton.
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.
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.
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).
The static context of an expression is the information that is available during static analysis of the expression, prior to its evaluation.
An error that can be detected during the static analysis phase, and is not a type error, is a static error.
A static function call consists of an EQName followed by a parenthesized list of zero or more arguments.
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.
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.
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 items that would result from calling the
fn:collection
function with this URI as its
argument.
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.
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.
Statically known decimal
formats. This is a mapping from QNames to decimal formats, with one default format that has no visible name,
referred to as the unnamed decimal format. Each
format is available for use when formatting numbers using the fn:format-number
function.
Statically known default collection type. This is the type of the sequence of
items that would result from calling the fn:collection
function with no arguments.
Statically known function definitions. This is a set of function definitions.
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.
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.
The string value of a node is a string and can be extracted by applying the Section 2.3 fn:string FO31 function to the node.
Substitution groups are defined in Section 2.2.2.2 Element Substitution Group XS1-1 and Section 2.2.2.2 Element Substitution Group XS11-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.
Given two sequence types or item types, the rules in this section determine if one is a subtype of the other. If a type A is a subtype of type B, it follows that every value matched by A is also matched by B.
The use of a value that has a dynamic type that is a subtype of the expected type is known as subtype substitution.
Each rule in the grammar defines one symbol, using the following format:
symbol ::= expression
Whitespace and Comments function as symbol separators. For the most part, they are not mentioned in the grammar, and may occur between any two terminal symbols mentioned in the grammar, except where that is forbidden by the /* ws: explicit */ annotation in the EBNF, or by the /* xgc: xml-version */ annotation.
A terminal is a symbol or string or pattern that can appear in the right-hand side of a rule, but never appears on the left-hand side in the main grammar, although it may appear on the left-hand side of a rule in the grammar for terminals.
A type alias
is an expanded QName that
is mapped to an ItemType
in the item type aliases of
the static context.
Each element node and attribute node in an XDM instance has a type annotation (described in Section 2.7 Schema Information DM31). The type annotation of a node is a reference to an XML Schema type.
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.
Under certain circumstances, an atomic value can be promoted from one type to another. Type promotion is used in evaluating function calls (see 4.4.1.1 Static Function Call Syntax) and operators that accept numeric or string operands (see B.2 Operator Mapping).
The typed value of a node is a sequence of atomic values and can be extracted by applying the Section 2.4 fn:data FO31 function to the node.
In the data model, a value is always a sequence.
A variable reference is an EQName preceded by a $-sign.
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.
In addition to static errors, dynamic errors, and type errors, an XPath 4.0 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.
A whitespace character is any of the characters defined by [http://www.w3.org/TR/REC-xml/#NT-S].
In these rules, if M and N are NameTests, then M wildcard-matches N is true if every name that matches M also matches N.
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.
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.
xs:error
is a simple type with no value space. It is defined in Section
3.16.7.3 xs:error
XS11-1 and can be used in the 3.4 Sequence Types to raise errors.
xs:untyped
is used as the type annotation of an element node that has not been validated, or has been validated in skip
mode.
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.
xs:yearMonthDuration
is derived by restriction from xs:duration
. The lexical representation of xs:yearMonthDuration
is
restricted to contain only year and month
components.
zero-digit is the character used to represent the digit zero; the default value is the Western digit zero (#x30). This character must be a digit (category Nd in the Unicode property database), and it must have the numeric value zero. This property implicitly defines the ten Unicode characters that are used to represent the values 0 to 9: Unicode is organized so that each set of decimal digits forms a contiguous block of characters in numerical sequence. Within the picture string any of these ten character can be used (interchangeably) as a place-holder for a mandatory digit. Within the final result string, these ten characters are used to represent the digits zero to nine.