Re: [xsl] for-each-group

Subject: Re: [xsl] for-each-group
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Tue, 27 Mar 2007 20:34:49 +0100
Robert C Corsaro wrote:
<products>
<xsl:for-each-group select="/products" group-by="product">
  <product><xsl:value-of select="product" /></product>
</xsl:for-each-group>
</products>

What am I doing wrong?  Basically I want something similar to 'GROUP BY'
 in SQL.

You're grouping the <products> element by the value of the <product> elements that it contains. You want to group the <product> elements based on their value:


<products>
  <xsl:for-each-group select="/products/product" group-by=".">
    <product><xsl:value-of select="." /></product>
  </xsl:for-each-group>
</products>

Cheers,

Jeni
--
Jeni Tennison
http://www.jenitennison.com

Current Thread