Hi Everyone,
I've been stuck on a XSLT problem trying to convert an XML doc to another XML and now I'm wondering if it's even possible to be done with XSTL. Here is a very simple breakdown of what I'm trying to do:
Convert this XML:
<Request>
<SomeTypeA>
<Variable>A</Variable>
</SomeTypeA>
<SomeTypeB>
<Variable>B</Variable>
</SomeTypeB>
<SomeTypeB>
<Variable>B</Variable>
</SomeTypeB>
</Request>
To:
<Group name = Request>
<Group name = SomeTypeA>
<Variable>A</Variable>
</Group>
<Group name = SomeTypeB>
<Item>
<Variable>A</Variable>
</Item>
<Item>
<Variable>A</Variable>
</Item>
</Group>
</Group>
The key here is I want to group all Nodes under <Request> that have the same name, in the example above <SomeTypeB> and process them together so that they belong to the same <Group name = SomeTypeB> after the conversion and they are separate by the new <Item> tags.
So far everything I tried has failed, the closest I get is that I get two sets <Group name = SomeTypeB> tags which is incorrect for my needs.
Can this even be done with XSLT or do I have to use Java or something else?
Much appreciated if you could solve this!!
Thanks