I'm not sure what you mean, but sum( //record[child::year='2009']/quantity )
seems to work for me. > Actually, it appears the sum function to total the quantity is made > for matching tags. Since you need to match the values I can't see > an easy way to code that. I would just use a variable to sum up the > quantity with a recursive call. You'll need a loop with a counter > going 1 through 12 inside a loop with a counter from curyear to > curyear - 3. You can loop using the recursive call. The best way to > do it might depend on the structure of your data if known. Could > there be more than 1 record with the same year and month? If not > maybe try the previous suggestion using xsl:sort. If you want to > allow multiples and not care if they exist and process them all in > random order, try the recursion. > <xsl:variable name="month_counter">0</xsl:variable> > <xsl:choose> > <xsl:when test="YEAR = $year_counter"> > <xsl:call-template name="count_month"><xsl:with-param > name="month_counter" select="$month_counter + 1"/></xsl:call-template> > </xsl:when> > </xsl:choose> > </xsl:template> > <xsl:template name="count_month"> > <xsl:param name="month_counter"/> > <xsl:if test="$month_counter < 12"><xsl:call-template > name="count_month"><xsl:with-param name="month_counter" > select="$month_counter + 1"/></xsl:call-template></xsl:if> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
