[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] Restrictind a set of notes to within a group


Subject: [xsl] Restrictind a set of notes to within a group
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Thu, 19 Apr 2012 07:17:11 -0700

have an xml file like
<Month>
   <Date day=b1b>
       <Session task=btask1b>
           <Notes hours-worked=b1.5b/>
       </Session>
       <Session task=btask2b>
           Notes hours-worked=b5b/>
       <Session task=btask1b>
           <Notes hours-worked=b3b/>
       </Session>
   </Date>
   <Date day=b2b>
       ....
   </Date>
</Month>
For the month, I want to sum all the hours-worked for each task:

I have tried several expressions, but failed. This gives me the total hours worked on all tasks rather than each individual task:
<xsl:for-each-group select="Date/Session" group-by="@task">
<xsl:for-each select=".">
<fo:block xsl:use-attribute-sets="subdiv2">
<xsl:value-of select="@task"/>
<xsl:text> (</xsl:text>
<xsl:value-of select="format-number(sum(../../Date/Session/Notes/@hours-worked), '.00')"/>
<xsl:text>) </xsl:text>
</fo:block>
</xsl:for-each>
</xsl:for-each-group>
How do I restrict the total to just the hours-worked on each specific task?
Thanks,
Mark



Current Thread
Keywords
xml