In XSLT 1.0, elimination of duplicates is best done using Muenchian grouping, see for example
http://www.jenitennison.com/xslt/grouping. In XSLT 2.0 it's best done using the new xsl:for-each-group instruction.
Neither handles a composite grouping key directly; you will have to form this using string concatenation. For example in 2.0
<xsl:for-each-group select="edge" group-by="concat(@source, '~', @dest)">
<xsl:copy-of select="."/>
</xsl:for-each-group>
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference