Dynamically adding multiple lines to API request based on a quantity field!?!?

So I’m working with a fairly difficult external API for holidays and I can only pass the information through a single XML parameter:

It’s simple enough to build the majority of it in the expression builder, but I’m stuck when I get to this bit:

<searchdetail type="hotel" checkin="2025-06-01" checkout="2025-06-15"  resultkey="default" destair="MCO">
  <room number="1">
    <adult></adult>
    <adult></adult>
    <infant></infant>
    <child age="3"></child>
    <child age="5"></child></room>
  <room number="2">
    <adult></adult>
    <adult></adult>
    <infant></infant>

All of the bit in the searchdetail tag is fine but the API requires that the guests are formatted this way. There can be any number of “rooms” and then each room could have any multiple of adults, of which each need an , the same for children and for infants, and the children need the ages. I can build all the inputs etc but I’m totally stuck on how to generate the right number of rooms and 's etc.

The API call will fail if I add a room with no guests so I can’t just have blank ones.

Does anybody know of any plugins or have any ideas how I can achieve it?

You may use :formated as text operator, you need to learn how to use it by reading the documentation and experimenting .