[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Counting total of groups

Subject: Counting total of groups
From: Francisco <francisco@xxxxxxxxxxxxxx>
Date: Thu, 01 Jun 2006 10:53:36 +0100
chasetravel.ie
Hi,
I have read the documentation regarding the grouping and the different examples to count the different groups and now my xslt file is doing this but I need as well to sum the different groups to have a total of groups but I can't get working.
How I can get this result before enter the for-each loop? I need this before to make a paginate page.


So If I have:
Group1
 2 elements
Group2
1 element
Group3
3 elements
I need to have that the number of groups is 3.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" omit-xml-declaration="yes" encoding="ISO-8859-1"/> <xsl:key name="hotelname" match="product" use="name" />
<xsl:template match="body">
<xsl:param name="counter" select="0"/>
<xsl:for-each select="product[count(. | key('hotelname', name)[1]) = 1]"> Number of elements for this group : <xsl:value-of select="$counter + count(key('hotelname', name))" /><br></br>
<xsl:sort select="name" />
<xsl:value-of select="name" />,<br />
<xsl:for-each select="key('hotelname', name)">
<xsl:value-of select="productID" /> <br />
<xsl:with-param name="counter" select="$counter + 1"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>


</xsl:stylesheet>


I would appreciate your help Regards Frank


Chasetravel.ie, Winner ITTN Awards 2005. "Best Hotel Booking Engine"

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.