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