Hello,
Thank you Martin for your help, you 're right. I correct my template
from mistakes:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="list" match="/Calls/Row" use="TechnicianName" />
<xsl:key name="pbType" match="/Calls/Row" use="ProblemType" />
<xsl:key name="Rc" match="/Calls/Row" use="Rc" />
<xsl:template match="Calls">
<html>
<body>
<xsl:variable name="var_TechnicianNamess"
select="/Calls/Row[count(. | key('list', TechnicianName)[1]) = 1]"/>
<xsl:for-each select="$var_TechnicianNamess">
<br />
<xsl:value-of select="TechnicianName" />
<xsl:value-of select="sum(key('list',
TechnicianName)/WorkTime)"/>
<br />
<xsl:value-of select="sum(key('pbType',
'INCYDENT')/WorkTime)" /><br />
<xsl:value-of select="sum(key('pbType',
'FAILURE')/WorkTime)" /><br />
<xsl:value-of select="count(key('Rc',
'InTime'))"/><br />
<xsl:value-of select="count(key('Rc',
'OutOfTime'))"/><br />
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
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
Thanks&Kind Regards,
Jack
2009/8/5 Martin Honnen <Martin(_dot_)Honnen(_at_)gmx(_dot_)de>:
Jacek Dunia wrote:
<Calls>
<Row NR="1">
<Rc>InTime</Rc>
<WorkTime>20</WorkTime>
<TechnicianName>Norman</TechnicianName>
<ProblemType>INCYDENT</ProblemType>
</Row>
<Row NR="2">
<Rc>OutTime</Rc>
<WorkTime>10</WorkTime>
<TechnicianName>Peter</TechnicianName>
<ProblemType>INCYDENT</ProblemType>
</Row>
<Row NR="3">
<Rc>InTime</Rc>
<WorkTime>150</WorkTime>
<TechnicianName>Norman</TechnicianName>
<ProblemType>FAILURE</ProblemType>
</Row>
<Row NR="4">
<Rc>OutOfTime</Rc>
<WorkTime>10</WorkTime>
<TechnicianName>Norman</TechnicianName>
<ProblemType>RemoteAccess</ProblemType>
</Row>
<Row NR="5">
<Rc>InTime</Rc>
<WorkTime>20</WorkTime>
<TechnicianName>Norman</TechnicianName>
<ProblemType>INCYDENT</ProblemType>
</Row>
<Row NR="6">
<Rc>InTime</Rc>
<WorkTime>20</WorkTime>
<TechnicianName>Peter</TechnicianName>
<ProblemType>INCYDENT</ProblemType>
</Row>
I would like get following out put
Name TotalWorkTimeByIncydent TotalWorkTimeByFailure TotalWorkTime
InTime OutOfTime
Peter 30 0 30 1
1
Norman 40 150 200 2
1
Thecnican name can't be duplicate so I make like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="list" match="/Activities/Row" use="TechnicianNames"
/>
The root element you show in your XML sample is named 'Calls', not
'Activities' so I would expect match="Calls/Row".
<xsl:template match="Activities">
Same here, shouldn't that be match="Calls"?
<html>
<body>
<xsl:variable name="var_TechnicianNamess"
select="/Activities/Row[count(. | key('list', TechnicianName)[1]) =
1]"/>
<xsl:for-each
select="$var_TechnicianNamess">
<xsl:value-of
select="TechnicianName" />
<xsl:value-of
select="sum(WorkMinute)" />
I think you want
<xsl:value-of select="sum(key('list',
TechnicianName)/WorkMinute)"/>
to sum up the WorkMinute(s) for each Technician.
--
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>
--~--
--~------------------------------------------------------------------
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>
--~--