How to group data from one xml to other using XSLT?



How can we group data from one xml to other using XSLT ?


For example suppose we have an input :



<Vehicle>
<Car Type="Sedan" Name="A"/>
<Car Type="Hatchback" Name="B"/>
<Car Type="Sedan" Name="C"/>
<Car Type="Mini" Name="D"/>
<Car Type="Mini" Name="E"/>
</Vehicle>


I want to change it to :



<Vehicle>
<Car Type="Sedan">
<Name>A</Name>
<Name>B</Name>
</Car>
<Car Type="Hatchback">
<Name>B</Name>
</Car>
<Car Type="Mini">
<Name>D</Name>
<Name>E</Name>
</Car>
</Vehicle>

No comments:

Post a Comment