# saxon:max()

max(node-set-1 , stored-expression)

This function returns the maximimum value of a numeric expression resulting from evaluating the supplied stored expression for each node in node-set-1 in turn, as a number. A stored expression may be obtained as the result of calling the saxon:expression function.

The stored expression is evaluated for each node in node-set-1 in turn, with that node as the context node, with the context position equal to the position of that node in node-set-1, and with the context size equal to the size of node-set-1. Any NaN values are ignored. If the node-set is empty, the result is negative infinity.

Example: saxon:max(sale, saxon:expression('@price * @qty')) will evaluate price times quantity for each child <sale> element, and return the maximum amount.

This function is deprecated, since the same effect can be achieved using standard XPath 2.0 functions and operators, for example, `max(for $s in sale return $s/@price * $s/@qty)`

Expand | Up Next