I can't follow all your code without knowing more about your problem, but my guess would be that in teh template name="graphml" you can simply replace
<xsl:for-each select="//a:graphml/.//a:cluster">
by something like
<xsl:for-each select="document('graphml.xml')//a:graphml/.//a:cluster">
There are lots of oddities in your code. For example the above path expression is equivalent to "//a:graphml//a:cluster"
I personally find this kind of code really verbose:
<xsl:element name="UML:Dependency">
<xsl:attribute name="xmi.idref">
<xsl:value-of select="@xmi.id"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:element>
Much better to write
<UML:Dependency xml.idref="{@xmi.id}">
<xsl:apply-templates/>
</UML:Dependency>
This match pattern:
match="UML:Namespace.ownedElement[local-name(parent::*[1]) = 'Model']
seems to be a particularly obscure way of writing:
match="*:Model/UML:Namespace.ownedElement"
(Do you really not know the namespace of the parent element?)
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference