I know that there are a bunch of examples here on how to do Muenchian grouping, but I have been trying for quite some time and havent been able to get it.
I am trying to group <spec>
based on their <title>
value using Muenchian grouping.
I am using XSLT 1.0.
XML:
<product>
<specifications>
<spec>
<title>A</title>
<value>val1</value>
</spec>
<spec>
<title>A</title>
<value>val2</value>
</spec>
<spec>
<title>B</title>
<value>val3</value>
</spec>
<spec>
<title>C</title>
<value>val4</value>
</spec>
<spec>
<title>C</title>
<value>val5</value>
</spec>
<spec>
<title>D</title>
<value>val6</value>
</spec>
<specifications>
</product>
Wanted Result:
<group>
<title>A</title>
<values>
<value>val1</value>
<value>val2</value>
</values>
</group>
<group>
<title>B</title>
<values>
<value>val3</value>
</values>
</group>
<group>
<title>C</title>
<values>
<value>val4</value>
<value>val5</value>
</values>
</group>
<group>
<title>D</title>
<values>
<value>val6</value>
</values>
</group>