[xsl] Simple grouping with XSL2

Subject: [xsl] Simple grouping with XSL2
From: Andy Kohn <andydev@xxxxxxxxx>
Date: Fri, 31 Jul 2009 13:14:07 +1000
I'm trying to do a simple grouping and then post the siblings but I'm
a little bit confused.

I have the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<Entries>
   <entry>
      <First>First Group</First>
      <Second>sample data I</Second>
   </entry>
   <entry>
       <First>Second Group</First>
      <Second>sample data II</Second>
   </entry>
    <entry>
        <First>First Group</First>
        <Second>sample data III</Second>
    </entry>
</Entries>

I'm trying to group the data using the <First> tag and then show all
the <Second> tags data.
Example of the result:

<Entries>
   <entryTransformation>
      <data>First Group</data>
      <secondaryData>sample data I</secondaryData>
      <secondaryData>sample data III</secondaryData>
   </entryTransformation>
   <entryTransformation>
      <data>Second Group</data>
      <secondaryData>sample data II</secondaryData>
   </entryTransformation>
</Entries>


I'm using
<xsl:for-each-group select="/Entries/entryTransformation/data" group-by=".">
To make the grouping, but then I don't know how to iterate the
<Second> elements.

Thanks,

Andy.

Current Thread