When I run the command :
java -jar saxon.jar generated.xmi test.xslt
the function named 'function1' in the file helpers.xslt should output a same xmi.id twice. The problem is that I get this xmi.id only once.
The key() function searches the current document, that is, the document containing the context node. Outside your xsl:for-each this is the principal source document. Inside the xsl:for-each it is the document identified by $interfaceDoc.