Arrow expressions

XPath 3.1 introduces the arrow operator =>, which is available to allow function chaining. Arrow expressions apply a function to a value, using the value of the left-hand expression as the first argument to the function on the right-hand side. For instance, the expression substring-before(substring-after($in, '['), ']') can now be replaced by the more legible $in => substring-after('[') => substring-before(']').

From XPath 4.0, a dynamic function call provided as the right-hand side for an arrow expression can now be an inline function, or a map or array constructor. (Implemented from Saxon 13.)

Mapping arrow operator

XPath 4.0 introduces the mapping arrow operator =!>. The expression LHS =!> f() applies the function on the right-hand side to each item delivered by the left-hand side individally. For example (-2 to +2) =!> abs() returns (2, 1, 0, 1, 2). The effect is similar to writing (-2 to +2) ! abs(.), but the operator precedences make it easier to construct a pipeline of operations without parentheses. The rules are similar to the XPath 3.1 arrow operator LHS => f() except that the function is not applied to the value of the left-hand operand as a whole, but to each item individually; it thus combines the functions of => and !, which accounts for the choice of operator symbol.