Definitions extracted from the XPath 3.1 draft

For ease of comparison to other materials, I have extracted the definitions listed below from http://www.w3.org/TR/2014/CR-xpath-31-20141218/, an XPath 3.1 draft.

The definitions are bounded by "[" and "]" markers (except in one case that I suspect is an editorial error noted below). I have included any notes or material within a paragraph following definitions. Most likely some, if not all, of that material should appear in notes.

Not all definitions were in separate paragraphs but I have separated them into separate paragraphs for ease of reading. The definitions appear in title attribute sort order, ignoring case distinctions and sort failures in the glossary.

My comments are colored red

This is version 0.1 of this document. Dated 12 January 2015.

Comments to: Patrick Durusau


[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.

[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.

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

[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

[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).

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

[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].]

[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].]

[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.

If there are one or more URIs in available documents that map to a document node D, then the document-uri property of D must either be absent, or must be one of these URIs.

Note:

This means that given a document node $N, the result of fn:doc(fn:document-uri($N)) is $N will always be true, unless fn:document-uri($N) is an empty sequence.

[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.

For every document node D that is in the target of a mapping in available node collections, or that is the root of a tree containing such a node, the document-uri property of D must either be absent, or must be a URI U such that available documents contains a mapping from U to D.

Note:

This means that for any document node $N retrieved using the fn:collection function, either directly or by navigating to the root of a node that was returned, the result of fn:doc(fn:document-uri($N)) is $N will always be true, unless fn:document-uri($N) is an empty sequence. This implies a requirement for the fn:doc and fn:collection functions to be consistent in their effect. If the implementation uses catalogs or user-supplied URI resolvers to dereference URIs supplied to the fn:doc function, the implementation of the fn:collection function must take these mechanisms into account. For example, an implementation might achieve this by mapping the collection URI to a set of document URIs, which are then resolved using the same catalog or URI resolver that is used by the fn:doc function.

[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.

Note:

An implementation may maintain some consistent relationship between the available node collections and the available resource collections, for example by ensuring that the result of fn:uri-collection(X)!fn:doc(.) is the same as the result of fn:collection(X). However, this is not required. The fn:uri-collection function is more general than fn:collection in that it allows access to resources other than XML documents; at the same time, fn:collection allows access to nodes that might lack individual URIs, for example nodes corresponding to XML fragments stored in the rows of a relational database.

[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.

[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.

[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.

[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].]

If collation is defined correctly elsewhere, why repeat it here?

[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.

A sequence may contain duplicate items, but a sequence is never an item in another sequence. When a new sequence is created by concatenating two or more input sequences, the new sequence contains all the items of the input sequences and its length is the sum of the lengths of the input sequences.

Note:

In places where the grammar calls for ExprSingle, such as the arguments of a function call, any expression that contains a top-level comma operator must be enclosed in parentheses.

[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?).]

The following examples illustrate the use of constructor functions:

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

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

[Definition: When the context item is a node, it can also be referred to as the context node.]

[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.

[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.

[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.]

[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].]

[Definition: decimal-separator specifies the character used for the decimal-separator-symbol; the default value is the period character (.)]

[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.]

[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.]

[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].

[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].

[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.]

[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.

[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.]

[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.

[Definition: The delimiting terminal symbols are: "!", "!=", StringLiteral, "#", "$", "(", ")", "*", "+", (comma), "-", (dot), "..", "/", "//", (colon), "::", ":=", "<", "<<", "<=", "=", "=>", ">", ">=", ">>", "?", "@", BracedURILiteral, "[", "]", "{", "|", "||", "}" ] in appendix A

[Definition: digit-sign specifies the character used for the digit-sign in the picture string; the default value is the number sign character (#)]

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

[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].

[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 . ]

[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.

[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).]

[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.)]

[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].]

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

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

[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.]

Note:

A possible implementation is to provide the set of POSIX environment variables (or their equivalent on other operating systems) appropriate to the process in which the expression is evaluated.

[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 .

[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.

Note lack of closing "]" for this defintion.

[Definition: exponent-separator Defines 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).]

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

[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.]

[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.)

[Definition: The first three components of the dynamic context (context item, context position, and context size) are called the focus of the expression. ]

[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.]

[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:

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

[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.)

[Definition: grouping-separator specifies the character used for the grouping-separator-symbol, which is typically used as a thousands separator; the default value is the comma character (,)]

[Definition: 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).] Ignorable whitespace characters are not significant to the semantics of an expression. Whitespace is allowed before the first terminal and after the last terminal of an XPath. Whitespace is allowed between any two terminals. Comments may also act as "whitespace" to prevent two adjacent terminals from being recognized as one. Some illustrative examples are as follows:

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

[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.]

[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.]

[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). ]

[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.

[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.]

[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: Rewrite to delete last sentence and to name the parts. BTW, there are 4 parts, not three, listed in the original In-scope schema definitions, In-scope element declaration, substitution groups, and In-scope attribute declarations. Should not use sub-lists in definitions as it makes the sub-definitions harder to find.

[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. ]

[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.]

An expression that binds a variable extends the in-scope variables, within the scope of the variable, with the variable and its type. Within the body of an inline function expression , the in-scope variables are extended by the names and types of the function parameters.

[Definition: infinity specifies the string used for the infinity-symbol; the default value is the string "Infinity"]

[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.]

[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.

Is material following "]" normative or part of an unmarked note?

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

[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:

[Definition: A lexical QName is a name that conforms to the syntax of [http://www.w3.org/TR/REC-xml-names/#NT-QName].]

[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.

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

[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).

[Definition: minus-sign specifies the character used for the minus-sign-symbol; the default value is the hyphen-minus character (-, #x2D). The value must be a single character.]

[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.

[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.]

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

[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.

[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.]

[Definition: NaN specifies the string used for the NaN-symbol, which is used to represent the value NaN (not-a-number); the default value is the string "NaN"]

External reference includes specific section, why not followed elsewhere?

[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.

[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.]

[Definition: 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", "eq", "every", "except", "following", "following-sibling", "for", "function", "ge", "gt", "idiv", "if", "in", "instance", "intersect", "is", "item", "le", "let", "lt", "map", "mod", "namespace", "namespace-node", "ne", "node", "of", "or", "parent", "preceding", "preceding-sibling", "processing-instruction", "return", "satisfies", "schema-attribute", "schema-element", "self", "some", "text", "then", "to", "treat", "union" ]

[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:

[Definition: A predicate whose predicate expression returns a numeric type is called a numeric predicate.]

[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.

The and and or operators are defined directly in the main body of this document, and do not occur in the operator mapping tables. In appendix B. Normative but an odd place for it.

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

[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.

[Definition: pattern-separator specifies the character used for the pattern-separator-symbol, which separates positive and negative sub-pictures in a picture string; the default value is the semi-colon character (;)]

[Definition: per-mille specifies the character used for the per-mille-symbol; the default value is the Unicode per-mille character (#x2030)]

[Definition: percent specifies the character used for the percent-symbol; the default value is the percent character (%)]

[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.]

[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:

[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].

Note:

The definition of pure union type excludes union types derived by non-trivial restriction from other union types, as well as union types that include list types in their membership. Pure union types have the property that every instance of an atomic type defined as one of the member types of the union is also a valid instance of the union type.

Note:

The current (second) edition of XML Schema 1.0 contains an error in respect of the substitutability of a union type by one of its members: it fails to recognize that this is unsafe if the union is derived by restriction from another union.

This problem is fixed in XSD 1.1, but the effect of the resolution is that an atomic value labeled with an atomic type cannot be treated as being substitutable for a union type without explicit validation. This specification therefore allows union types to be used as item types only if they are defined directly as the union of a number of atomic types.

[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. Bold should only highlight "resolve."

Any process that attempts to resolve URI against a base URI, or to dereference the URI, may apply percent-encoding or decoding as defined in the relevant RFCs.

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

[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].

If the keys in a map constructor contain both date/time values with a timezone and date/time values with no timezone, a dynamic error is raised [err:XPDY0139]. The term "date/time value" here means an instance of any of the types xs:dateTime, xs:date, xs:time, xs:gYear, xs:gYearMonth, xs:gMonth, xs:gMonthDay, or xs:gDay.

Note:

The reason for this rule is that comparison of a date/time value with timezone to one without timezone depends on knowing the implicit timezone. If values with timezones and values without timezones could be mixed in the same map, such a map could become invalid when the implicit timezone changes. The rule therefore ensures that the constraint that no two entries have the same key applies regardless what timezone is used for the assessment. Without this rule, for example, a map created in a static variable could be invalid during stylesheet execution, since the implicit timezone used during the analysis phase can differ from that used during evaluation.

[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.)

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

[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.]

[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. Omitted from glossary?

[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).

[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.]

[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 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).]

[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.

[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.

[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.

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

[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.

[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.

If an implementation does not support the Static Typing Feature, but can nevertheless determine during the static analysis phase that an XPath expression, if evaluated, would necessarily raise a dynamic error or that an expression, if evaluated, would necessarily raise a type error, the implementation may raise that error during the static analysis phase. The choice of whether to raise such an error at analysis time is implementation dependent.

[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.]

[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()*.

Note:

The purpose of the statically known collections is to provide static type information, not to determine which collections are available. A URI need not be found in the statically known collections to be accessed using fn:collection.

[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().]

Each decimal format contains three sets of properties, which control the interpretation of characters in the picture string supplied to the fn:format-number function, and also specify characters that may appear in the result of formatting the number.

[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()*.

[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()?.

Note:

The purpose of the statically known documents is to provide static type information, not to determine which documents are available. A URI need not be found in the statically known documents to be accessed using fn:doc.

The sort order is off on statically known collections, statically known documents, statically known collations, and statically known default collection type in the glossary. "off" meaning out of normal sort order

[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.

The statically known function signatures include the signatures of functions from a variety of sources, including built-in functions described in [XQuery and XPath Functions and Operators 3.1], and constructor functions . Implementations must ensure that no two functions have the same expanded QName and the same arity (even if the signatures are consistent).

[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.

[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.

[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].

[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.]

[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).

[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.

[Definition: Each rule in the grammar defines one symbol, using the following format:

[Definition: 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.]

It is customary to separate consecutive terminal symbols by whitespace and Comments, but this is required only when otherwise two non-delimiting symbols would be adjacent to each other. There are two exceptions to this, that of "." and "-", which do require a symbol separator if they follow a QName or NCName. Also, "." requires a separator if it precedes or follows a numeric literal.

[Definition: 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.] The following constructs are used to match strings of one or more characters in a terminal:

[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. ]

[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.]

[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).]

[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.]

[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.]

Note:

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. Surely this is a note as well. Introducing name confusion. How will a user know when URI means URI and wen it means URI + IRI? Covering up prior mistakes isn't a proper role for standards.

Note:

In most contexts, processors are not required to raise errors if a URI is not lexically valid according to [RFC3986] and [RFC3987]. See 2.4.5 URI Literals for details.

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

[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.

[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.]

[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.]

[Definition: A whitespace character is any of the characters defined by [http://www.w3.org/TR/REC-xml/#NT-S].]

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

[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. ]

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

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

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

[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.]

Note:

xs:anyAtomicType will not appear as the type of an actual value in an XDM instance.

[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.]

[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 SequenceType Syntax to raise errors.]

[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.

[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.

[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.]

[Definition: zero-digit specifies the character used for the zero-digit-symbol; the default value is the digit zero (0). This character must be a digit (category Nd in the Unicode property database), and it must have the numeric value zero. This attribute implicitly defines the Unicode character that is used to represent each of the values 0 to 9 in the final result string: Unicode is organized so that each set of decimal digits forms a contiguous block of characters in numerical sequence.]