[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

Subject: RE: Grouping is not working that great over here
From: Américo Albuquerque <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Mon, 14 Apr 2003 14:17:36 +0100
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.