Saxonica.com

saxon:leading()

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

This function returns a sequence containing all those nodes from nodes-1 up to and excluding the first one (in order of the input sequence) for which $stored-expression evaluates to false. 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 (taken in document order), and with the context size equal to the size of $nodes-1.

Example:

saxon:leading(following-sibling::*, saxon:expression('self::para'))

will return the <para> elements following the current node, stopping at the first element that is not a </para>

Note: this function is quite different from the EXSLT leading() function, though both fulfil a similar purpose.

Next