title: Biztalk Mapper Table Looping Logical mapping
body: <p>I have a looping node NationalityDet which holds multiple current former nationality or citizenships (CurrentNatCit) I need to ensure that all the Country values for Current Nationality map go to the nationality node and Current citizenship are mapped to Citizenship node, all former Nationality/citizenship are mapped to the OtherNationality/OtherCitizenship (Citizenship is only allowed one record it is node).  Any ideas?</p>
  
  <h2>Source sample</h2>
  
  <pre><code>&lt;NationalityDet&gt;
     &lt;NatCit&gt;
        &lt;Type&gt;NATIONALITY/CITIZENSHIP&lt;/Type&gt;
        &lt;Status&gt;CURRENT/FORMER&lt;/Status&gt;
        &lt;Country&gt;UK&lt;/Country&gt;
     &lt;/NatCit&gt;
     &lt;OtherNatCit&gt;
        &lt;Type&gt;NATIONALITY/CITIZENSHIP&lt;/Type&gt;
        &lt;Status&gt;CURRENT/FORMER&lt;/Status&gt;
        &lt;Country&gt;UK&lt;/Country&gt;
     &lt;/OtherNatCit&gt;
  &lt;/NationalityDet&gt;
  </code></pre>
  
  <h2>Destination sample</h2>
  
  <pre><code>&lt;Person&gt;
     &lt;Person1&gt;
        &lt;Nationality&gt;NATIONALITY/CURRENT&lt;/Nationality&gt;
        &lt;Nationality&gt;NATIONALITY/CURRENT&lt;/Nationality&gt;
        &lt;Nationality&gt;NATIONALITY/CURRENT&lt;/Nationality&gt;
        &lt;Citizenship&gt;CITIZENSHIP/CURRENT&lt;/Citizenship&gt;
        &lt;Citizenship&gt;CITIZENSHIP/CURRENT&lt;/Citizenship&gt;
        &lt;Citizenship&gt;CITIZENSHIP/CURRENT&lt;/Citizenship&gt;
        &lt;OtherNationality&gt;
           &lt;Nationality&gt;NATIONALITY/FORMER&lt;/Nationality&gt;
           &lt;Nationality&gt;NATIONALITY/FORMER&lt;/Nationality&gt;
           &lt;Nationality&gt;NATIONALITY/FORMER&lt;/Nationality&gt;
        &lt;/OtherNationality&gt;
        &lt;OtherCitizenship&gt;CITIZENSHIP/FORMER&lt;/OtherCitizenship&gt;
     &lt;/Person1&gt;
  &lt;/Person&gt;
  </code></pre>
  
  <p>Currently have used the looping functoid u mentioned and a number of equals and &amp;'s to allow for this mapping. I am stuck in regards to counting the nodes from two different parent nodes for TYPE=CITIZENSHIP and STATUS=FORMER for OtherCitizenship. any thoughts?</p>