Looks like a multi-pass problem to me: break the problem down into a number of smaller problems.
There's an element of grouping here and grouping problems, especially cross-document grouping problems, are always easier with XSLT 2.0.
Phase 1 is probably to build your consolidated client file, which can be done something like:
<xsl:for-each-group select="collection(....)/x/client" group-by="name">
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference