Friday, 19 September 2014

XSLT: Split and merge XML elements



I'm a beginner in XSLT programming. I've got the task to transform the following xml:



<Test>TestA::test1</Test>
<Test>TestA::test2</Test>
<Test>TestB::test3</Test>
<Test>TestB::test4</Test>


The output xml shall look like this:



<TestClass id="TestA">
<TestMethod id="test1"/>
<TestMethod id="test2"/>
</TestClass>
<TestClass id="TestB">
<TestMethod id="test3"/>
<TestMethod id="test4"/>
</TestClass>


I've tried a lot of different approaches and read myriad stackoverflow threds, but couldn't find a solution.


Thanks in advance, mexl


No comments:

Post a Comment