I've got an XML:
<?xml version="1.0" standalone="yes"?>
<root>
<profile>
<name>xyz</name>
<salary1>4</salary1>
<salary2>2</salary2>
</profile>
<profile>
<name>mno</name>
<salary1>8</salary1>
<salary2>6</salary2>
</profile>
</root>
and a XSLT:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="exsl"
version="1.0">
<xsl:template match = "/" >
<html>
<head><title></title></head>
<body>
<br />
<table border="0">
<tr>
<td class="headerClass">name</td>
<td class="headerClass">salary1</td>
<td class="headerClass">salary2</td>
</tr>
<xsl:for-each select="//root/profile">
<tr>
<td><center><xsl:value-of select="name"/></center></td>
<td><center><xsl:value-of select="salary1"/></center></td>
<td><center><xsl:value-of select="salary2"/></center></td>
</tr>
</xsl:for-each>
<tr>
<td>Sum</td>
<td><center><xsl:value-of select="sum(/root/profile/salary1)"/></center></td>
<td><center><xsl:value-of select="sum(/root/profile/salary2)"/></center></td>
</tr>
<xsl:variable name="cal">
<xsl:for-each select="/root/profile">
<xsl:value-of select="(salary1 * 100) div (salary1 + salary2)"/>
</xsl:for-each>
</xsl:variable>
<tr>
<td>Calculations</td>
<td><center><xsl:value-of select="$cal"/></center></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
and now I've got a variable "cal" which consist of two numbers and looks like 66.66666666666667157.142857142857146, but I wanna to separate these numbers and add it together, then divide by the number of the numbers, in my example:
66.66666666666667157.142857142857146
divide into:
66.666666666666671 and 57.142857142857146
then (66.666666666666671 + 57.142857142857146)/2
I've got XSLT version 1.0, and using VS 2008. Could anyone help me, please?