Most of the XSLT 1.0 grouping techniques work only on nodes in a single document, so you have to merge the documents first and then do grouping. The main exception is Ken Holman's "variable grouping" technique described at
http://sourceware.org/ml/xsl-list/2001-10/msg00933.html
With XSLT 2.0, of course, xsl:for-each-group solves it easily.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference