|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Trying to display Summed Average of Grouped Data
Hi Dom,
> In Brief im trying to display the Averages of each Column for each
> individual Days results so far all the methods ive tried have either
> led to a "0" or the summing of the Entire collection rather than per
> day...i tried using variables but found it impossible to
> manipulate...i fear my xpath knowledge is letting me down ...
It looks as though you're trying to update variables, which of course
you can't do in XSLT. Try this:
<xsl:template match="Log">
<xsl:variable name="LogsForDate" select="key('rows', @Date)" />
<xsl:variable name="Count" select="count($LogsForDate)" />
<table>
...
<tr>
<td bgcolor="#99CCCC">Averages:</td>
<td bgcolor="#cccc99">
<xsl:value-of select="round(sum($LogsForDate/@T_CPU) div $Count)"/>
</td>
...
</tr>
</table>
</xsl:template>
The important thing is that you gather up all the logs for the
particular date in a variable, and then you use the sum() function to
sum whatever you want to sum in order to calculate the average.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








