Was recently working on an XSLT filter that extracted the text portion of SVG graphics into another file for translation. Once translated I needed a mechanism to merge the text back into the graphic. The document function did nicely.
Example:
<xsl:key name="descriptionlookup" match="Descriptions/Description" use="@name"/> <xsl:variable name="desc" select="document('desc.xml')"/>Later....
<xsl:template match="InsertDescription"> <xsl:variable name="key_value" select="@lookup"/> <xsl:for-each select="$desc"> <xsl:copy-of select="key('descriptionlookup',$key_value)/Para"/> </xsl:for-each> </xsl:template>