RE: [xsl] for-each-group

Subject: RE: [xsl] for-each-group
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 28 Mar 2007 00:16:37 +0100
> <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've only got one "products" element, so grouping it isn't going to be
very interesting...

I think there's a tendency for people coming from SQL to use the name of a
wrapper element as if it's the name of a table and thus refers to the set of
elements it contains. You need to clear your head of SQL (and most other
languages) to use XSLT/XPath successfully.

Michael Kay

Current Thread