I Change Log (Non-Normative)

This appendix lists the changes that have been made to this specification since the publication of XPath 3.1 Recommendation.

I.1 Changes since version 3.1

I.1.1 Substantive Changes

The following changes have been agreed by the working group:

  1. Function definitions in the static context may now have optional parameters, provided this does not cause ambiguity across multiple function definitions with the same name. Optional parameters are given a default value, which can be any expression, including one that depends on the context of the caller (so an argument can default to the context item).

  2. In a static function call, arguments can be specified either positionally or using keywords, or a combination of both.

  3. The rules for "errors and optimization" have been tightened up to disallow many cases of optimizations that alter error behavior. In particular there are restrictions on reordering the operands of and and or, and of predicates in filter expressions, in a way that might allow the processor to raise dynamic errors that the author intended to prevent.

The following changes are present in this draft, but are awaiting review and agreement:

  1. The static context now allows the default namespace for elements and the default namespace for types to be different. XSLT 4.0 takes advantage of this, XQuery 4.0 currently does not.

  2. A new with expression allows namespace bindings to be defined within an expression (and to be redefined in nested expressions).

  3. The static context now allows the unprefixed function names to be resolved using an arbitrary algorithm, rather than requiring the resolution to use a default namespace.

  4. The rules for reporting type errors during static analysis have been changed so that a processor has more freedom to report errors in respect of constructs that are evidently wrong, such as @price/@value, even though dynamic evaluation is defined to return an empty sequence rather than an error.

  5. Record types are added as a new kind of ItemType, constraining the value space of maps.

  6. Local union types are added as a new kind of ItemType, constraining the value space of atomic values.

  7. Enumeration types are added as a new kind of ItemType, constraining the value space of strings.

  8. Element and attribute tests of the form element(N) and attribute(N) now allow N to be any NameTest, including a wildcard.

  9. The "function conversion rules" are now renamed "coercion rules".

  10. The coercion rules allow "relabeling" of a supplied atomic value where the required type is a derived atomic type: for example, it is now permitted to supply the value 3 when calling a function that expects an instance of xs:positiveInteger.

  11. New abbreviated syntax is introduced for simple inline functions.

  12. The lookup operator "?" can now be followed by a string literal, for cases where map keys are strings other than NCNames.

  13. An otherwise operator is introduced: A otherwise B returns the value of A, unless it is an empty sequence, in which case it returns the value of B.

  14. A ternary conditional expression (A ?? B !! C) is introduced.

  15. The arrow operator => is now complemented by a "thin arrow" operator -> which applies a function to each item in the input sequence independently.

  16. The rules for value comparisons when comparing values of different types (for example, decimal and double) have changed to be transitive. A decimal value is no longer converted to double, instead the double is converted to a decimal without loss of precision. This may affect compatibility in edge cases involving comparison of values that are numerically very close.

  17. A for member clause is added to FLWOR expressions to allow iteration over an array.

  18. Mathematical operator symbols are available as alternatives to alphabetic operator names, for example div can be written as รท, while intersect can be written as .

I.1.2 Editorial Changes

  1. The presentation of the rules for the subtype relationship between sequence types and item types has been substantially rewritten to improve clarity; no change to the semantics is intended.

  2. The operator mapping table has been simplified by removing entries for the operators ne, le, gt, and ge; these are now defined by reference to the rules for the operators eq and lt.