Im now to XSLT and I need to do some grouping with the value of a child. I have objects, that can have multiple properties and one of them (with id=11) is on I need to use as a grouping element. The amount of properties each object can have varies, but they all have the common prop.
Input:
<object id=1>
<properties>
<prop id=10>Name of object 1</prop>
<prop id=11>Group 1</prop>
<prop id=xy>Whatever properties this object has</prop>
</properties>
</object>
<object id=2>
<properties>
<prop id=10>Name of object 2</prop>
<prop id=11>Group 2</prop>
</properties>
</object>
<object id=3>
<properties>
<prop id=10>Name of object 3</prop>
<prop id=11>Group 1</prop>
</properties>
</object>
<object id=4>
<properties>
<prop id=10>Name of object 4</prop>
<prop id=11>Group 3</prop>
</properties>
</object>
Desired output:
<group name='Group 1'>
<object id=1>
<prop id=10>Name of object 1</prop>
<prop id=11>Group 1</prop>
<prop id=xy>Whatever properties this object has</prop>
</object>
<object id=3>
<properties>
<prop id=10>Name of object 3</prop>
<prop id=11>Group 1</prop>
</properties>
</object>
</group>
<group name='Group 2'>
<object id=2>
<properties>
<prop id=10>Name of object 2</prop>
<prop id=11>Group 2</prop>
</properties>
</object>
</group>
<group name='Group 3'>
<object id=4>
<properties>
<prop id=10>Name of object 4</prop>
<prop id=11>Group 3</prop>
</properties>
</object>
</group>
The idea is to have the items grouped by the value of the prop with id 11.
Ive found multiple different code samples, but none of them have had this specific case, and I havent been able to modify them to suit my need.