[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] using xsl:for-each-group, grouping by child nodes?


Subject: [xsl] using xsl:for-each-group, grouping by child nodes?
From: Eric Scheid <eric.scheid@xxxxxxxxxxxxxxx>
Date: Sat, 04 Oct 2008 17:38:36 +1000

I have export data that looks like this:

<RESULTSET FOUND="6">
    <ROW MODID="3" RECORDID="1">
        <COL><DATA>joe</DATA></COL>
        <COL><DATA>2</DATA></COL>
        <COL><DATA>pitcher</DATA></COL>
        <COL><DATA>ny</DATA></COL>
        <COL><DATA>mets</DATA></COL>
    </ROW>
    <ROW MODID="3" RECORDID="2">
        <COL><DATA>mark</DATA></COL>
        <COL><DATA>11</DATA></COL>
        <COL><DATA>outfielder</DATA></COL>
        <COL><DATA>ny</DATA></COL>
        <COL><DATA>mets</DATA></COL>
    </ROW>
    <ROW MODID="3" RECORDID="3">
        <COL><DATA>jane</DATA></COL>
        <COL><DATA>13</DATA></COL>
        <COL><DATA>outfielder</DATA></COL>
        <COL><DATA>ny</DATA></COL>
        <COL><DATA>cubs</DATA></COL>
    </ROW>
    <ROW MODID="3" RECORDID="4">
        <COL><DATA>mike</DATA></COL>
        <COL><DATA>7</DATA></COL>
        <COL><DATA>outfielder</DATA></COL>
        <COL><DATA>ny</DATA></COL>
        <COL><DATA>mets</DATA></COL>
    </ROW>
</RESULTSET>

I'm trying to transform it into this:

    Team: mets, ny
        pitchers:
            joe, 2
        oufielders:
            mark, 11
            mike, 7

    Team: cubs, ny
        outfielders:
            jane, 13

.. so naturally I thought of using for-each-group, only problem is I can't
find any examples which shows how to group-by using values in the child
nodes .. so I don't know if this is even possible, let alone exactly how to
specify it. I've tried a few different things to no avail.

Is this even possible?

e.


-- 
Ironclad Networks
Information Architecture
http://www.ironclad.com.au/

"Providing tactical IA services to web agencies"


Current Thread