title: XSLT transform list of repeating elements
body: <p>I'm trying to do something like an iteration over element names. I'm given Input in the form of</p>
  
  <pre><code>&lt;list&gt;
      &lt;element1&gt;ID 1&lt;/element1&gt;
      &lt;element2&gt;name 1&lt;/element2&gt;
      &lt;element3&gt;town 1&lt;/element3&gt;        
      &lt;element4&gt;ID 2&lt;/element4&gt;
      &lt;element5&gt;name 2&lt;/element5&gt;
      &lt;element6&gt;town 2&lt;/element6&gt;
      &lt;!-- list continues like that --&gt;
  &lt;/list&gt;
  </code></pre>
  
  <p>Now my target scheme is supposed to look like that:</p>
  
  <pre><code>&lt;newlist&gt;
      &lt;Person&gt;
          &lt;ID&gt;ID 1&lt;/ID&gt;
          &lt;Name&gt;name 1&lt;/Name&gt;
          &lt;Town&gt;town 1&lt;/Town&gt;
      &lt;/Person&gt;
      &lt;Person&gt;
          &lt;ID&gt;ID 2&lt;/ID&gt;
          &lt;Name&gt;name 2&lt;/Name&gt;
          &lt;Town&gt;town 2&lt;/Town&gt;
      &lt;/Person&gt;
      &lt;!-- more Persons here --&gt;
  &lt;/newlist&gt;
  </code></pre>
  
  <p>The entries in the first list are always repeating in the same way, so what came to my mind is iterating over them and applying a modulo-operator to a loop-counter in order to figure out the right element the entry should be mapped to.
  However I could not find a Transformation like this. What would be the way to go here?</p>