Hi there!
Is it possible in xslt 1.0 compare two calculated values? For example, I've got xml:
Code:
<?xml version="1.0" standalone="yes"?>
<root>
<profile>
<name>xyz</name>
<salary>4</salary>
</profile>
<profile>
<name>mno</name>
<salary>8</salary>
</profile>
</root>
and xslt:
Code:
<?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">salary</td>
</tr>
<xsl:for-each select="//root/profile">
<tr>
<td><center><xsl:value-of select="name"/></center></td>
<td><center><xsl:value-of select="salary"/></center></td>
</tr>
</xsl:for-each>
<tr>
<td>Sum</td>
<td><center><xsl:value-of select="sum(/root/profile/salary)"/></center></td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
so as a result I've got a table like that:
xyz 4
mno 8
Sum 12
but I wanna change some value in xml, e.g. xyz from 4 to 5, so the Sum will be 13, and compare new value with the previous one, and show an information if the value has changed, is it possible to achieve? Maybe I have to save previous value in some variable, or file?