There are different ways to get the desired sum based on the XSLT version being used.
XSLT 2.0 allows using the XPath in the sum() function so the below code will provide the desired output.
<xsl:template match="EMPLOYMENT">
<SOMENODE>
<xsl:attribute name="GROSSINCOME">
<xsl:value-of select="sum(EARNEDINCOME/(@EARNEDINCOMEAMOUNT * @PAYMENTFREQUENCYTYPE))" />
</xsl:attribute>
</SOMENODE>
</xsl:template>
XSLT 1.0 does not provide a simple way to achieve this. If using XSLT 1.0, you will have write a recursive template call which will do the product for every node and then keep on adding them for all the nodes.
<xsl:template match="EMPLOYMENT">
<SOMENODE>
<xsl:attribute name="GROSSINCOME">
<xsl:call-template name="ProductSum">
<xsl:with-param name="earnedIncome" select="*" />
</xsl:call-template>
</xsl:attribute>
</SOMENODE>
</xsl:template>
<xsl:template name="ProductSum">
<xsl:param name="earnedIncome" />
<xsl:param name="sum" select="0" />
<xsl:variable name="nodeStart" select="$earnedIncome[1]" />
<xsl:variable name="nodeEnd" select="$earnedIncome[position() > 1]" />
<xsl:variable name="currSum" select="$nodeStart/@EARNEDINCOMEAMOUNT * $nodeStart/@PAYMENTFREQUENCYTYPE" />
<xsl:choose>
<xsl:when test="not($nodeEnd)">
<xsl:value-of select="$sum + $currSum" />
</xsl:when>
<xsl:otherwise>
<!-- Recursive call to the same template -->
<xsl:call-template name="ProductSum">
<xsl:with-param name="earnedIncome" select="$nodeEnd" />
<xsl:with-param name="sum" select="$sum + $currSum" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Using EXSLT (Extension functions) - If using XSLT 1.0 and if you can use extension functions, the node-set() function can be used.
<xsl:template match="/EMPLOYMENT">
<!-- create a variable to store the EARNEDINCOME nodes along
with a new attribute ANNUALINCOME that has the product
of the attributes -->
<xsl:variable name="nodes">
<xsl:for-each select="EARNEDINCOME">
<xsl:copy>
<xsl:copy-of select="@*"/>
<!-- add a new attribute to EARNEDINCOME node -->
<xsl:attribute name="ANNUALINCOME">
<xsl:value-of select="@EARNEDINCOMEAMOUNT * @PAYMENTFREQUENCYTYPE" />
</xsl:attribute>
</xsl:copy>
</xsl:for-each>
</xsl:variable>
<SOMENODE>
<xsl:attribute name="GROSSINCOME">
<!-- use the node-set function to compute the sum
of this new attribute from the above variable -->
<xsl:value-of select="sum(exslt:node-set($nodes)/EARNEDINCOME/@ANNUALINCOME)" />
</xsl:attribute>
</SOMENODE>
</xsl:template>
All the XSLTs will give the same output
<SOMENODE GROSSINCOME="73224"/>