Saxon's implementation of the EXSLT set:leading
function doesn't implement the rule:
"If the second node set is empty, then the first node
set is returned. "
Instead, it implements the rule:
If the second node set is empty, then the empty node
set is returned.
Saxon also doesn't implement the rule:
"If the first node in the second node set is not
contained in the first node set, then an empty node set
This rule is particularly horrible, in fact it requires
a complete redesign of the implementation, because it
means that the function can't be pipelined. You can't
decide whether the first node in arg1 should be
included in the result until you have read all the
nodes in arg1. Saxon returns all the nodes in arg1 that
precede the first node in arg2.
Similar problems are probably present in set:trailing()
Test case added (for the first problem) in exslt31
Present in 6.5.2, in 7.2, and in earlier releases.