[Home] [By Thread] [By Date] [Recent Entries]
Yes, recursion is one way of doing it. I just got help with a similar problem but basically, you pass the rows to the template and allow the template to call itself with the new values until its spent. Below is something I think will get you halfway there.. <xsl:template match="Record"> <!-- running totals of hours already used --> <xsl:param name="used">0</xsl:param> <xsl:param name="usedSSA">0</xsl:param> <!-- running totals of quota not used --> <xsl:param name="leftSSA">0</xsl:param> <xsl:choose> <!-- Capacity used up, output used and move on --> <xsl:when test="(hours = $used)"> <tr> <td><xsl:value-of select="service" /></td> <td><xsl:value-of select="round(hours)" /></td> <td><xsl:value-of select="round($usedSSA)" /></td> </tr> <xsl:apply-templates select="following-sibling::Record[1]"> <xsl:with-param name="leftSSA" select="$leftSSA" /> </xsl:apply-templates> </xsl:when> <xsl:when test="not($leftSSA = 0)"> <xsl:choose> <xsl:when test="($leftSSA >= (hours - $used))"> <xsl:apply-templates select="."> <xsl:with-param name="used" select="hours" /> <xsl:with-param name="usedSSA" select="($usedSSA + hours - $used)" /> <xsl:with-param name="leftSSA" select="($leftSSA - (hours - $used))" /> </xsl:apply-templates> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="."> <xsl:with-param name="used" select="($used + $leftSSA)" /> <xsl:with-param name="usedSSA" select="($usedSSA + $leftSSA)" /> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="."> <xsl:with-param name="used" select="hours" /> <xsl:with-param name="usedSSA" select="$usedSSA" /> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> On 7/26/06, Sonja.Hendrick@xxxxxxxxxxx <Sonja.Hendrick@xxxxxxxxxxx> wrote: I will attempt to describe my issue that has been frustrating me...
|

Cart



