title: XSLT For-Each loop to get data from enumerated tags?
body: <p>I've been provided an SML file where the designer (not in my company, so I have no control over this) has created some data that I need to consume; but they setup enumerated tags, so I'm having a difficult time creating a loop to read the data. </p>
  
  <p>Their code looks like </p>
  
  <pre><code>   &lt;Root&gt;
      &lt;Subjects&gt;
      &lt;...more XML Data&gt;
      &lt;Data&gt;
        &lt;...other XML Data&gt;
        &lt;Demographic_Information&gt;
              &lt;Age1&gt;33&lt;/Age1&gt;
              &lt;Age2&gt;66&lt;/Age2&gt;
              &lt;Age3 /&gt;
              &lt;Age4 /&gt;
              &lt;Age5 /&gt;
              &lt;Age6 /&gt;
              &lt;Age7 /&gt;
              &lt;Age8 /&gt;
              &lt;Age9 /&gt;
              &lt;Age10 /&gt;
              &lt;Gender1&gt;M&lt;/Gender1&gt;
              &lt;Gender2&gt;F&lt;/Gender2&gt;
              &lt;Gender3 /&gt;
              &lt;Gender4 /&gt;
              &lt;Gender5 /&gt;
              &lt;Gender6 /&gt;
              &lt;Gender7 /&gt;
              &lt;Gender8 /&gt;
              &lt;Gender9 /&gt;
              &lt;Gender10 /&gt;
              &lt;Race1&gt;W&lt;/Race1&gt;
              &lt;Race2&gt;H&lt;/Race2&gt;
              &lt;Race3 /&gt;
              &lt;Race4 /&gt;
              &lt;Race5 /&gt;
              &lt;Race6 /&gt;
              &lt;Race7 /&gt;
              &lt;Race8 /&gt;
              &lt;Race9 /&gt;
              &lt;Race10 /&gt;
          &lt;/Demographic_Information&gt;
          &lt;/...other XML Data&gt;
      &lt;/Data&gt;
      &lt;/...more XML Data&gt;
     &lt;/Subjects&gt;
    &lt;/Root&gt;
  </code></pre>
  
  <p>I just need to loop through this, and ensure that Age1, Gender1, and Race1 go into my data like </p>
  
  <pre><code>&lt;Person subject="1"&gt;
      &lt;Age&gt;33&lt;/Age&gt;
      &lt;Gender&gt;M&lt;/Gender&gt;
      &lt;Race&gt;W&lt;/Race&gt;
  &lt;/Person&gt;
  &lt;Person subject="2"&gt;
      &lt;Age&gt;66&lt;/Age&gt;
      &lt;Gender&gt;F&lt;/Gender&gt;
      &lt;Race&gt;A&lt;/Race&gt;
  &lt;/Person&gt;
  </code></pre>
  
  <p>This is a subset of data inside a larger set, but I need to get it into this format if possible.  I'm sure it can be done, I just don't know how to go about it.  </p>
  
  <p>My XSLT is version 1.0 in Microsoft Visual Studio 2008.  I start with </p>
  
  <pre><code>&lt;xsl:template match="/Root/Subjects"&gt;
  </code></pre>
  
  <p>***Modified to provide a better sample of my issue.</p>