Mega Code Archive

 
Categories / XML Tutorial / XSLT StyleSheet
 

Sum value

File: Data.xml <math>  <operand>12</operand>  <operand>23</operand>  <operand>45</operand>  <operand>56</operand>  <operand>75</operand> </math> File: Transform.xslt <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">   <xsl:output method="text" />   <xsl:template match="math">     <xsl:value-of select="sum(operand)" />   </xsl:template> </xsl:stylesheet> Output: 211