xsl-list
[Top] [All Lists]

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

2009-08-05 12:50:11
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
technican.
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="http://www.w3.org/1999/XSL/Transform";>
        
        <xsl:key name="list" match="/Calls/Row" use="TechnicianName" />
        <xsl:output indent="yes"/>

        <xsl:template match="Calls">
                <html>
                        <body>
                          <table>
                            <thead>
                              <tr>
                                <th>Name</th>
                                <th>Total Work Time</th>
                                <th>Total Work Time INCYDENT</th>
                                <th>Total Work Time FAILURE</th>
                                <th>InTime</th>
                                <th>OutOfTime</th>
                              </tr>
                            </thead>
                            <tbody>
<xsl:for-each select="Row[count(. | key('list', TechnicianName)[1]) = 1]">
                                  <tr>
<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>
                                  </tr>


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


--

        Martin Honnen
        http://msmvps.com/blogs/martin_honnen/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--