How to put 2 different array collections into transformed XML

Hello,

I am taking one format XML and need to transform it into the different format.
The problem that I have is:
I have 2 same items in one tag, for example:

"<Sums>
   <Item1>
      <Price>20</Price>
   </Item1>
   <Item2>
      <Price>25</Price>
   </Item2>
</Sums>

The problem is that “Item*” count is dynamic, which means this can vary, in the XML there can be 1item or multiple of them.

How can I take all of them and transform into different tags? For example to make:

<TotalSUM>
   <AITEM>
      <Pricetag>20</Pricetag>
   </AITEM>
   <AITEM1>
      <Pricetag>25</Pricetag>
   </AITEM1>
</TotalSUM>

I can`t find the way to do it, because it all ends up with 2 operations instead of one XML:

I can`t find the way to loop as long as there is different packages like this:

Hi
You could try doing this:

In your input field, instead of setting htmlinput, try to set this:

{{
replace(htmlinput;/<(/?)(ItemTypeA|ItemTypeB)\d+(/s*/?)>/g;<$1$2$3>)
}}

List as many ItemTypeA/B/C as tags you want to handle
This should handle:

  • Every ItemType tags
  • Opening tags <ItemTypeA>
  • Closing tags </ItemTypeA>
  • Empty tags <ItemTypeA />