Something like
<xsl:key name="applicant" match="Party[@Type='Applicant']"
use="Identifier/@UniqueID"/>
then
sum(//ValueItem[key('applicant', PercentOwned/RelatedEntityRef/@RelatedID)])
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference