Subject: [xsl] Recursion Help with Summing Durations From: Seth Ladd <seth@xxxxxxxxx> Date: 29 Apr 2002 14:28:08 -0400 |
Hello, I am trying to use the EXSLT template add-duration. I have a node-set of durations that I'd like to sum together. My named template is not working, and I was hoping someone could give me some hints or tips on where to go to make this recursion work properly. My environment: Java 1.3.1 Xalan2 Cocoon 2.0.2 I've tested that I'm getting the correct node-set by using count(). I've also hard-coded some values into add-duration to make sure it works. I've been scanning documentation all day, and coming up empty. I might be getting tripped up with the difference between node-sets and RTFs, but that's where my XSLT gets fuzzy. Any tips or suggestions would be greatly appreciated! Thanks so much, Seth My template: <xsl:template name="total-durations"> <xsl:param name="durations"/> <xsl:choose> <xsl:when test="$durations"> <xsl:variable name="first" select="$durations[1]"/> <xsl:variable name="rest"> <xsl:call-template name="total-durations"> <xsl:with-param name="durations" select="$durations[position()!=1]"/> </xsl:call-template> </xsl:variable> <xsl:call-template name="date:add-duration"> <xsl:with-param name="duration1" select="$first"/> <xsl:with-param name="duration2" select="$rest"/> </xsl:call-template> </xsl:when> <xsl:otherwise>P0M</xsl:otherwise> </xsl:choose> </xsl:template> I call it with this (while I am in the timecard element): <xsl:call-template name="total-durations"> <xsl:with-param name="durations" select="shift/duration"/> </xsl:call-template> And my original document looks like: <timecard> <shift> <duration>P13M</duration> </shift> <shift> <duration>P43M</duration> </shift> </timecard> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Cross-referencing accross mul, David Chryst | Thread | [xsl] Sequences: how to get them (e, Richard Bondi |
Re: [xsl] problem in using * as a d, Oleg Tkachenko | Date | [xsl] Sequences: how to get them (e, Richard Bondi |
Month |