Subject: [xsl] Problem with sum values with double param From: Jacek Dunia <jacenty87@xxxxxxxxx> Date: Wed, 5 Aug 2009 15:39:01 +0200 |
Hello, I'm writing because I have got problem with filtrate by first TechnicanName ProblemType(total WorkTime per technican), and number of activites InTime and out of time. Xml input file <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="recovery.xsl" type="text/xsl" ?> <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" /> <xsl:template match="Activities"> <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)" /> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet> Problemi with sum work minutes because function sum return me sum from all Rows, I can' use for this sum() and key() for examples: <xsl:key name="lista" match="/Calls/Row" use="TechnicanNames" /> <xsl:value-of select="sum(key('lista', 'Norman')/WorkTime" /> because I can't put statically technican names. I have got similar problem with ProblemType, I try like this <xsl:key name="pbT" match="/Calls/Row" use="ProblemType" /> <xsl:value-of select="sum(key('lista', 'INCYDENT')/WorkTime" /> I must use xslt v1.0 Please for help Kind regards, Jack
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to strip off all <xsd, Michael Ludwig | Thread | Re: [xsl] Problem with sum values w, Martin Honnen |
Re: [xsl] How to strip off all <xsd, Martin Honnen | Date | Re: [xsl] Problem with sum values w, Martin Honnen |
Month |