Try something like:
<xsl:value-of select="100*count(/list/student/class[.='1']) + 200*count(/list/student/class[.='2'])"/>
Question
<?xml version="1.0"?>
<list>
<student>
<name>Tom</name>
<class>1</class>
</student>
<student>
<name>Jerry</name>
<class>2</class>
</student>
</list>
and this my XSL file, i show information "Name" and "Class" and show "Money" with condition in the template Money
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<head>
<title>TomJerryXSL.xsl</title>
</head>
<body>
<table border="1" >
<tr>
<td>Name</td>
<td>Class</td>
<td>Money</td>
</tr>
<xsl:for-each select="/list/student">
<tr>
<td><xsl:value-of select="./name"/></td>
<td><xsl:value-of select="./class"/></td>
<td>
<xsl:call-template name="money">
<xsl:with-param name="class">
<xsl:value-of select="./class"/>
</xsl:with-param>
</xsl:call-template>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
<xsl:template name="money">
<xsl:param name="class"/>
<xsl:choose>
<xsl:when test="$class=1">
<xsl:value-of select="100"/>
</xsl:when>
<xsl:when test="$class=2">
<xsl:value-of select="200"/>
</xsl:when>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
i want show Total 300
Name Class Money
Tom 1 100
Jerry 2 200
How can I summarize money and show it in html Sorry beacause my English is not good
La solution
Try something like:
<xsl:value-of select="100*count(/list/student/class[.='1']) + 200*count(/list/student/class[.='2'])"/>