Saxonica.com

saxon:lowest()

lowest($nodes-1 as node()*) ==> node()*

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

This function returns (as a sequence of nodes) the node from $nodes-1 that has the lowest value of the supplied stored expression, evaluated as a number.

If the stored expression is omitted, the function is equivalent to the EXSLT set:lowest() function. It returns the node (or nodes, if there are several) whose numeric value (obtained using number(.)) is lower than any other node in the input sequence.

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 nodes is empty, the result is an empty sequence. If several nodes have the lowest value, the result node is the one that is first in the order of the input sequence. This differs from the EXSLT lowest() function, which returns all the nodes that have the minimum value.

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

Next