Thanks for the clarification. So you have this code ...
<xsl:variable name="external" select="document('ext.xml')"/> <xsl:variable name="fragment"> <xsl:for-each select="$external"> <xsl:copy-of select="key(...)"/> </xsl:for-each> </xsl:variable> Here, <xsl:for-each select="$external"> will not be much useful, as it represents the root node of the external document (ext.xml). This actually selects 1 node (which is the root node). Something like this could be useful: <xsl:for-each select="$external/a/b/c"> Also, they key() function at this position will operate on the tree formed by ext.xml and not on the primary document. Is this what you need? Without seeing more of the code, it's difficult to say what could be wrong. Also if you could tell what you are trying to accomplish, we could probably suggest better ways to solve the problem. On 4/18/08, Peter Nabbefeld <[EMAIL PROTECTED]> wrote: > Sorry, I should have written > ... > <xsl:for-each select="$external"> -- Regards, Mukul Gandhi