xsl-list
[Top] [All Lists]

[xsl] Summing hours-worked values from previous siblings only to determine accrued hours

2012-04-13 15:16:26
I am creating a work-report sheet that needs to know the value of working hours accrued to the current date for each date. The xml looks like this

<Month name=”April”>
<Date day="1">
  <Session task="LS Authorities">
    <Notes hours-worked="2.00" notes="Documented changes from last week."/>
  </Session>
</Date>
<Date day="2">
  <Session task="LS Authorities">
<Notes hours-worked="2.00" notes="Worked with Wayne resolving $2 border cases (see Campfire notes)."/> <Notes hours-worked="1.50" notes="Final boarder case resolution and 655/150 issue."/>
  </Session>
</Date>
</Month>

I can get a Daily total of hours worked with a named template called from the Sessions template, but how can I show the hours accrued for all previous days? For the XLM given, My output for the first Date should be “Daily Total: 2.0 Accrued: 2.0.”
and for the second Date “Daily Total: 3.5. Accrued: 5.5.”

That is, I need to know the value of all *previous* hours-worked and exclude any *following* hours-worked. The XSLT so far look like this:


<xsl:template match="Session">
   <fo:table-row>
     <fo:table-cell>
       <fo:block xsl:use-attribute-sets="subdiv1">
        <xsl:value-of select="@task"/>
       </fo:block>
     </fo:table-cell>
   </fo:table-row>
     <xsl:apply-templates/>
   <xsl:call-template name="day-total"/>
 </xsl:template>

<xsl:template name="day-total">
 <fo:table-row>
   <fo:table-cell>
     <fo:block xsl:use-attribute-sets="subdiv3">
       <fo:wrapper xsl:use-attribute-sets="title">
         <xsl:text>Daily Total: </xsl:text>
       </fo:wrapper>
         <xsl:value-of select="sum(Notes/@hours-worked)"/>
       <fo:wrapper xsl:use-attribute-sets="title">
           <xsl:text>Accrued: </xsl:text>
       </fo:wrapper>
<!-- What goes here to select all previous Notes/@hours-worked???
           <xsl:value-of select="sum(?????????????Notes/@hours-worked)"/>
     </fo:block>
   </fo:table-cell>
 </fo:table-row>
</xsl:template>



--~------------------------------------------------------------------
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>
--~--