Просто для удовольствия, компактный XSLT 1.0:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:key name="kCustomerByValue" match="CUSTOMER_31" use="."/>
<xsl:template match="text()"/>
<xsl:template match="CUSTOMER_31[count(.|key('kCustomerByValue',.)[1])=1]">
<xsl:for-each select="key('kCustomerByValue',.)">
<xsl:value-of select="concat(substring(concat(.,' '),
1+(position()!=1),
1),
' ',
../PERCENT_NAME_OF_OWNERS_32,
'
')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
и одна строка XPath 2.0:
string-join(for $customer
in distinct-values(/Ownership_Shareholders_S
/Ownership_Shareholders
/CUSTOMER_31)
return /Ownership_Shareholders_S
/Ownership_Shareholders[CUSTOMER_31=$customer]
/PERCENT_NAME_OF_OWNERS_32
/concat(if (position()=1)
then $customer
else replace($customer,'.',' '),
' ',.),
'
')