Re: [xsl] Problem with sum values with double param

Subject: Re: [xsl] Problem with sum values with double param
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Wed, 05 Aug 2009 18:49:29 +0200
Jacek Dunia wrote:

But my main problem remains, namely how to make other columns per
Technican. When I normal use funcion sum() or count() with function
key() I get values for all technicans, and I would like get for each
like this:
Name	TotalWorkTimeByIncydent	TotalWorkTimeByFailure	TotalWorkTime	InTime	OutOfTime
Peter		30				0					30				1		1	
Norman		40				150					200				2		1	

Does this do what you want?

<xsl:stylesheet version="1.0" xmlns:xsl="";>

<xsl:key name="list" match="/Calls/Row" use="TechnicianName" />
<xsl:output indent="yes"/>

<xsl:template match="Calls">
<th>Total Work Time</th>
<th>Total Work Time INCYDENT</th>
<th>Total Work Time FAILURE</th>
<xsl:for-each select="Row[count(. | key('list', TechnicianName)[1]) = 1]">
<td><xsl:value-of select="TechnicianName" /></td>
<td><xsl:value-of select="sum(key('list', TechnicianName)/WorkTime)"/></td>
<td><xsl:value-of select="sum(key('list', TechnicianName)[ProblemType = 'INCYDENT']/WorkTime)" /></td>
<td><xsl:value-of select="sum(key('list', TechnicianName)[ProblemType = 'FAILURE']/WorkTime)" /></td>
<td><xsl:value-of select="count(key('list', TechnicianName)[Rc = 'InTime']/WorkTime)"/></td>
<td><xsl:value-of select="count(key('list', TechnicianName)[Rc = 'OutOfTime']/WorkTime)"/></td>

</xsl:for-each> </tbody> </table> </body> </html> </xsl:template> </xsl:stylesheet>


	Martin Honnen

Current Thread