Altova Mailing List Archives

[xsl] Accumulating Sum

From: "KUMAR NINGASHETTY" <kningashetty@---------------->
Date: 4/2/2002 9:10:00 AM

Sample XML

 	<vehicle id="768">
		<region id="204">
			<region_name><![CDATA[Region 4]]></region_name>
		<company_name><![CDATA[ABC Inc.]]></company_name>
	<vehicle id="232">
		<region id="204">
			<region_name><![CDATA[Region 4]]></region_name>
		<company_name><![CDATA[BBC Inc.]]></company_name>

	<vehicle idref="768">
		<count type="N"><![CDATA[1]]></review_count>
		<count type="U"><![CDATA[2]]></review_count>
		<count type="Y"><![CDATA[3]]></review_count>
	<vehicle idref="232">
		<count type="N"><![CDATA[4]]></count>
		<count type="U"><![CDATA[5]]></count>
		<count type="Y"><![CDATA[6]]></count>


HTML O/P should look lilke follows after applying XSL
Region 4

       Comp        stat	  typN    Total
        -----	-        -----	  ----        -----
      ABCInc        t	   1	5 
      BBCInc        f	   4	5	

Problem :  I could populate first 3 columns..To populate the 4th column 'Total' which is sum frm each row of column 'typeN'

Detailed Explanation in case :
I have put together a sample XML above and the html output it should look like ...
I have used xsl:key and have grouped by regions to get the first 4 columns data  and it works fine .. I have problem getting the 4 th column which is Total which  is total from all the rows under column typeN.....This is huge XML data and i have just put together to rows of XML data onto html .  My problem is to get the Total  and printing it on the Total column.  I have tough  time accumulating the average sum inspite if using recursive methods...Let me know if anyone has any ways...

Thanx in advance ...

- kumar

 XSL-List info and archive:


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.