The tool-box <xml>cmp provides a grouping-tool xmltoxml.sh, which also
can convert date-formats.
You need a basic-control-file and a toxml-control-file for executing
toxml.sh.
basic-control-file: cmp126.xml
<events>
<event ident_att_nr="true">
<starts_at
ident_text="true"
conv_text1_in="yyyy-MM-dd-HH:mm"
conv_text1_out="HH:mm"
conv_text1_class="de.sofika.test.ConvertDate"
/>
</event>
</events>
toxml-control-file: toxml126
<events>
<starts_at ident_att_time="true"
path_att_time="/events/event/starts_at">
<event ident_att_nr="true" />
</starts_at>
</events>
example-file: test126.xml
<events>
<event nr="1">
<starts_at>2006-10-20-09:00</starts_at>
</event>
<event nr="2">
<starts_at>2006-10-20-10:00</starts_at>
</event>
<event nr="3">
<starts_at>2006-10-21-09:00</starts_at>
</event>
<event nr="4">
<starts_at>2006-08-01-10:00</starts_at>
</event>
</events>
Executing the grouping produce this result:
$ xmltoxml.sh cmp126.xml toxml126.xml test126.xml
<events>
<starts_at time='09:00'>
<event nr='1'>
</event>
<event nr='3'>
</event>
</starts_at>
<starts_at time='10:00'>
<event nr='2'>
</event>
<event nr='4'>
</event>
</starts_at>
</events>
<xml>cmp has also a comparing, sorting and merging-tool.
See
http://www.xmlcmp.com