xsl-list
[Top] [All Lists]

[xsl] Group and sort nodes by attribut in child node

2011-10-14 08:52:50
Hi everyone,

I need to group nodes by attributes which are in a child node. To be more 
specific, this is my XML:

<record>
   <column field="keyword" value="A">
   <column field="Start_Date" value="23.12.2010">
   <column field="Group" value="">
</record>
<record>
   <column field="keyword" value="B">
   <column field="Start_Date" value="24.12.2010">
   <column field="Group" value="X_Group">
</record>
   <column field="keyword" value="D">
   <column field="Start_Date" value="25.12.2010">
   <column field="Group" value="">
</record>
<record>
   <column field="keyword" value="C">
   <column field="Start_Date" value="23.12.2010">
   <column field="Group" value="X_Group">
</record>
</record>
   <column field="keyword" value="D">
   <column field="Start_Date" value="25.12.2010">
   <column field="Group" value="Y_Group">
</record>
<record>
   <column field="keyword" value="E">
   <column field="Start_Date" value="26.12.2010">
   <column field="Group" value="Y_Group">
</record>
<record>

The result should be like this:
  A - 23.10.2010
  X_Group
    C - 23.10.2010
    B - 24.12.2010
  D - 25.10.2010
  Y_Group
    D - 25.12.2010
    E - 26.12.2010

I want to group by the value of the group field in the column node and 
everything should be sorted by start_date. The name of the group (e.g. X_Group) 
should start a group-block, followed by the record nodes which belong to the 
group value.
Another problem is that i don´t know the group value in advance, because they 
can be set to whatever the user want.

If there is a solution which i didn´t found, could you please point me in the 
right direction?

Thanks in advance.

Best,
Jens
___________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--