title: How to handle For each condition in Data weaver: Mule
body: <p>I'm getting struggle in looping the entries in data weaver. Below is the Input and the expected response.
     Not sure how to make loop(I need to get <code>RecordEntry</code> and each entry with 'IndividualEntry') .</p>
  
  <p>Input xml : Record entry tag  in input xml is 3, but I might get many. So need to make a loop as dynamic.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Records&gt;
    &lt;storenumber /&gt;
    &lt;calculated&gt;false&lt;/calculated&gt;
    &lt;subTotal&gt;12&lt;/subTotal&gt;
    &lt;RecordsEntries&gt;
      &lt;RecordEntry&gt;
        &lt;deliverycharge&gt;30.0&lt;/deliverycharge&gt;
        &lt;entryNumber&gt;8&lt;/entryNumber&gt;
        &lt;Value&gt;true&lt;/Value&gt;
      &lt;/RecordEntry&gt;
      &lt;RecordEntry&gt;
        &lt;deliverycharge&gt;20.0&lt;/deliverycharge&gt;
        &lt;entryNumber&gt;7&lt;/entryNumber&gt;
        &lt;Value&gt;false&lt;/Value&gt;
      &lt;/RecordEntry&gt;
      &lt;RecordEntry&gt;
        &lt;deliverycharge&gt;1.0&lt;/deliverycharge&gt;
        &lt;entryNumber&gt;6&lt;/entryNumber&gt;
        &lt;Value&gt;false&lt;/Value&gt;
      &lt;/RecordEntry&gt;
    &lt;/RecordsEntries&gt;
  &lt;/Records&gt;
  </code></pre>
  
  <p>Expected Response ( I'm expecting the below response) </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;orders&gt;
    &lt;order&gt;
      &lt;StoreID /&gt;
      &lt;Total&gt;false&lt;/Total&gt;
      &lt;IndividualEntry&gt;
        &lt;Number&gt;8&lt;/Number&gt;
        &lt;DeliverCharge&gt;30.0&lt;/DeliverCharge&gt;
      &lt;/IndividualEntry&gt;
      &lt;IndividualEntry&gt;
        &lt;Number&gt;7&lt;/Number&gt;
        &lt;DeliverCharge&gt;20.0&lt;/DeliverCharge&gt;
      &lt;/IndividualEntry&gt;
      &lt;IndividualEntry&gt;
        &lt;Number&gt;6&lt;/Number&gt;
        &lt;DeliverCharge&gt;1.0&lt;/DeliverCharge&gt;
      &lt;/IndividualEntry&gt;
    &lt;/order&gt;
  &lt;/orders&gt;
  </code></pre>
  
  <p>My Data weaver Transformation as below</p>
  
  <pre><code>%dw 1.0
  %output application/xml
  ---
  { 
    orders: {
      order: {
        StoreID:payload.Records.storenumber,
        Total: payload.Records.calculated,
        IndividualEntry: payload.Records.RecordsEntries.*RecordEntry map {
          Number:$.entryNumber,
          DeliverCharge:$.deliverycharge
        }
      }
    }
  }
  </code></pre>
  
  <p>Currently I'm getting response as below ( I don't know how to make each Record entry as a <code>IndividualEntry</code> tag, and also here <code>element</code> tag is added in extra which is not required in my case)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;orders&gt;
    &lt;order&gt;
      &lt;StoreID /&gt;
      &lt;Total&gt;false&lt;/Total&gt;
      &lt;IndividualEntry&gt;
        &lt;element&gt;
          &lt;Number&gt;8&lt;/Number&gt;
          &lt;DeliverCharge&gt;30.0&lt;/DeliverCharge&gt;
        &lt;/element&gt;
        &lt;element&gt;
          &lt;Number&gt;7&lt;/Number&gt;
          &lt;DeliverCharge&gt;20.0&lt;/DeliverCharge&gt;
        &lt;/element&gt;
        &lt;element&gt;
          &lt;Number&gt;6&lt;/Number&gt;
          &lt;DeliverCharge&gt;1.0&lt;/DeliverCharge&gt;
        &lt;/element&gt;
      &lt;/IndividualEntry&gt;
    &lt;/order&gt;
  &lt;/orders&gt;
  </code></pre>
  
  <p>Could any one help me in fix this. Thanks in advance.    </p>