In Xalan I've been noticing very inconsistent results when calling key() when the context node is a node from a result tree fragment that has been converted to a node-set with exsl:node-set().
I am having trouble isolating it into a simple test case, but for example, I'm seeing a case where the xsl:key definition clearly only matches elements, but calling key() occasionally returns a text node, or returns an empty node-set while a previous call with the same arguments returns elements. This inconsistent key() behavior interferes with the use of the Muenchian method on converted result tree fragments. Has anyone else noticed key() problems like this? Any chance you've reduced such problems to a simple test case?