I'm using XSLT 1.0 and am trying to group by two elements in my XML. Basically I'd like to transform the following XML:
<requirements>
<item>
<category>Admin</category>
<functionality>View Data</functionality>
<requirement>The system shall do 1</requirement>
</item>
<item>
<category>Admin</category>
<functionality>View Data</functionality>
<requirement>The system shall do 2</requirement>
</item>
<item>
<category>Admin</category>
<functionality>Query Data</functionality>
<requirement>The system shall do 3</requirement>
</item>
<item>
<category>Admin</category>
<functionality>Query Data</functionality>
<requirement>The system shall do 4</requirement>
</item>
</requirements>
Into this:
<requirements>
<item>
<category>Admin</category>
<functionality>View Data</functionality>
<requirement id ="1">The system shall do 1</requirement>
<requirement id ="2">The system shall do 2</requirement>
</item>
<item>
<category>Admin</category>
<functionality>Query Data</functionality>
<requirement id="1">The system shall do 3</requirement>
<requirement id="2">The system shall do 4</requirement>
</item>
</requirements>
I just don't have enough experience with XSLT yet to implement the Muenchian method correctly.
Any help is greatly appreciated.
items
byfunctionality
and the@id
onrequirement
has the valuen
for thenth requirement
. Please feel free to post your try here. – Lingamurthy CS