|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Grouping and Subtotals
I may have stumbled upon the solution after posting this message: After the <xsl:for-each select> line, I created a $currentGroup variable. I then used it during the sum operation. So far in my testing, it appears to work. Can anyone see anything wrong with this? ------------------------------------------------------------------------ ----------------- <xsl:key name="listofbrochures" match="RECORD" use="BrochureName" /> <xsl:template match="DATA"> <table> <xsl:for-each select="RECORD[count(. | key('listofbrochures',BrochureName)[1]) = 1]"> <xsl:variable name="currentGroup" select="key('listofbrochures', BrochureName)" /> <tr> <td nowrap="true" class="dataValue"> <xsl:value-of select="BrochureName"/> </td> <td align="center" class="dataValue"> <xsl:value-of select="format-number(BrochureID,'#,##0')"/> </td> <td align="right" class="dataValue"> <xsl:value-of select="format-number(sum($currentGroup/./ProjectedUnits),'#,##0')"/> </td> <td align="right" class="dataValue"> <xsl:value-of select="format-number(sum($currentGroup/./ProjectedForActual),'#,##0')"/ > </td> <td align="right" class="dataValue"> <xsl:value-of select="format-number(sum($currentGroup/./ActualUnits),'#,##0')"/> </td> <td align="right" class="dataValue"> <xsl:value-of select="format-number(sum($currentGroup/./RemainingProjected),'#,##0')"/ > </td> </tr> </xsl:for-each> <tr> <td colspan="2" class="dataValue" align="right"><strong>Totals:</strong></td> <td class="dataValue" align="right"><xsl:value-of select="format-number(sum(//ProjectedUnits),'#,##0')"/></td> <td class="dataValue" align="right"><xsl:value-of select="format-number(sum(//ProjectedForActual),'#,##0')"/></td> <td class="dataValue" align="right"><xsl:value-of select="format-number(sum(//ActualUnits),'#,##0')"/></td> <td class="dataValue" align="right"><xsl:value-of select="format-number(sum(//RemainingProjected),'#,##0')"/></td> </tr> </table> </xsl:template> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






