[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Grouping is not working that great over here
Hi > -----Original Message----- > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx > [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of > Matts Isuls > Sent: Friday, April 11, 2003 6:32 AM > To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx' > Subject: Grouping is not working that great over here > > > Hi > > Having problems grouping (first timer). Someone please help > me out of this darkness. > (...) Your main problem is that you are grouping by all 'payment' but you only want to group by those that have the same parent 'payments' To do that you'll have to change a little your key definition and your for-each call. <!-- you'll need the generate-id(parent::payments) because you want all payment belonging to the same parent --> <xsl:key name="mkey" match="payment[date]" use="concat(generate-id(parent::payments),' ',date)"/> (...) <xsl:template match="parcel"> <br/> ------ <!-- altered for-each --> <xsl:for-each select="payments/payment[generate-id()=generate-id(key('mkey',concat(generat e-id(parent::payments),' ' ,date))[1])]"> <xsl:sort select="date" /> <br/> <!-- here you'll just need to sum the amount of the keys nodeset --> <xsl:value-of select="date"/>::<xsl:value-of select="sum(key('mkey',concat(generate-id(parent::payments),' ' ,date))/amount)"/> </xsl:for-each> </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
|