Saxonica.com

saxon:highest()

saxon:highest($nodes-1 as node()*) => node()*

This form of the function returns the node or nodes from the input that have the highest numeric value, as computed using the expression "number(.)". This is equivalent to the EXSLT set:highest() function.

saxon:highest($nodes-1 as node()*, $stored-expression as jt:net.sf.saxon.functions.Evaluate-PreparedExpression) => node()?

This form of the function returns the node that has the highest value for the given stored expression.

A stored expression may be obtained as the result of calling the saxon:expression function.

The stored expression is evaluated for each node in $nodes-1 in turn, with that node as the context node, with the context position equal to the position of that node in $nodes-1, and with the context size equal to the size of $nodes-1. Any NaN values are ignored. If the input sequence is empty, the result is an empty sequence. If several nodes have the highest value, the result nodes contains the one that is first in the order of the input sequence. This differs from the EXSLT highest() function, which returns all the nodes that have the maximum value.

Example: saxon:highest(sale, saxon:expression('@price * @qty')) will evaluate price times quantity for each child <sale> element, and return the node for which this has the highest value.

Next