title: XSLT for-each loop iterating through 2 elements
body: <p>I'm a complete novice with XSLT so apologies if solutions to other questions relating to loops would work for my problem but I've had no luck so far.</p>
  
  <p>I have an XML file with multiple nodes such as the following:</p>
  
  <pre><code>&lt;Roles&gt;
      &lt;Role&gt;User&lt;/Role&gt;
      &lt;Purpose&gt;General User&lt;/Purpose&gt;
      &lt;Role&gt;Staff&lt;/Role&gt;
      &lt;Purpose&gt;Company Staff&lt;/Purpose&gt;
      &lt;Role&gt;Admin&lt;/Role&gt;
      &lt;Purpose&gt;Administration&lt;/Purpose&gt;
  &lt;/Roles&gt;
  </code></pre>
  
  <p>I need to loop through these nodes and print &lt;Role&gt; along with its matching &lt;Purpose&gt;. However, if I use a for-each loop it will iterate through the &lt;Role&gt;s fine but print the same &lt;Purpose&gt; for each (just the first Roles/Purpose element. </p>
  
  <p>Is there any way I can sync them up so that, for example, when the for-each loop is on its second iteration it picks the second &lt;Purpose&gt; along with the second &lt;Role&gt; so it ends up something like this? </p>
  
  <pre><code>User - General User
  Staff - Company Staff
  Admin - Administration
  </code></pre>
  
  <p>I have been looking at using params such as the following but I get "element with-param is not allowed within that context" error when complining (probably my lack of XSLT understanding using it wrong). </p>
  
  <pre><code>&lt;xsl:param name="i" select="1"/&gt;
  </code></pre>
  
  <p>I have to keep the elements separate (i.e. I can't just do &lt;Role&gt;User - General User&lt;/Role&gt; due to annoying formatting reasons but if anyone could think an alternative to loops which would work as well I would appreciate it.</p>