forum

home / developersection / forums / parse repeating child elements in non-repeating parent node

Parse repeating child elements in non-repeating parent node

Anonymous User 2800 06-Nov-2014

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.


Updated on 06-Nov-2014

I am a content writter !

Can you answer this question?

Answer

1 Answers

Liked By