Parse repeating child elements in non-repeating parent node



I have the following input xml and was wondering if XSLT can handle such transformation. If it can, how can it be achieve?


input xml:



<foo>
<bar>
<A>xxx</A>
<B>yyy</B>
<C>zzz</C>
<A>aaa</A>
<B>bbb</B>
<C>ccc</C>
...
..
</bar>
</foo>


output xml:



<data>
<A>xxx</A>
<B>yyy</B>
<C>zzz</C>
</data>
<data>
<A>aaa</A>
<B>bbb</B>
<C>ccc</C>
</data>
....


There could be more repeating A, B, C nodes in the example above. Since the repetition isn't in a repeating parent node, it's not possible to use for-each. I was exploring the option of for-each-group but not sure if that is applicable. Would appreciate any advise.


No comments:

Post a Comment