XSLT - group response as per month and year combination
- by alisha
I want into write xslt to get response for the input xml. thanks in advance. I want to group output such that month year combination is not repeated for each of the employee details.
Input XML:
<resultset>
<row>
<column>
<name>Month</name>
<value>2</value>
</column>
<column>
<name>Year</name>
<value>2010</value>
</column>
<column>
<name>EmpName</name>
<value>Anu</value>
</column>
<column>
<name>Age</name>
<value>24</value>
</column>
</row>
<row>
<column>
<name>Month</name>
<value>2</value>
</column>
<column>
<name>Year</name>
<value>2010</value>
</column>
<column>
<name>EmpName</name>
<value>Nancy</value>
</column>
<column>
<name>Age</name>
<value>26</value>
</column>
</row>
<row>
<column>
<name>Month</name>
<value>3</value>
</column>
<column>
<name>Year</name>
<value>2010</value>
</column>
<column>
<name>EmpName</name>
<value>Ned</value>
</column>
<column>
<name>Age</name>
<value>25</value>
</column>
</row>
</resultset>
Output expected:
<Response>
<PeriodInfo>
<Month>2</Month>
<Year>2010</Year>
<EmployeeDetails>
<Name>Anu</Name>
<Age>24</Age>
</EmployeeDetails>
<EmployeeDetails>
<Name>Nancy</Name>
<Age>26</Age>
</EmployeeDetails>
</PeriodInfo>
<PeriodInfo>
<Month>3</Month>
<Year>2010</Year>
<EmployeeDetails>
<Name>Ned</Name>
<Age>25</Age>
</EmployeeDetails>
</PeriodInfo>
</Response>