Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Grouping XML elements

Hi,
How can I transform the following:

<doc>
<stuff>
<a type="1" subtype="2">A</a>
<a type="1" subtype="2">B</a>
<a type="1" subtype="2">C</a>
<a type="2" subtype="3">ZZ</a>
<a type="2" subtype="3">WW</a>
<a type="3">JJ</a>
</stuff>

<stuff>
<a type="1" subtype="2">AA</a>
<a type="1" subtype="2">BB</a>
</stuff>
</doc>

into text output like the following using an XSLT stylesheet:

type(1) subtype(2): A, B, C. type(2) subtype(3): ZZ, WW. type(3): JJ.
type(1) subtype(2): AA, BB.

That is, each <stuff> is to be on a line of its own.

Many thanks,
Michael.
[805 byte] By [Michael Leung] at [2007-11-9 15:28:56]