title: xsl transform of dataset.writexml XML
body: <p>I have a scenario where I am exporting a .net dataset to an xml file, but I want to transform the stucture of the xml output to a more hierarchical structure. Below is the format of the dataset as exported by dataset.xmlwrite() method.</p>
  
  <pre><code>&lt;NewDataSet&gt;
      &lt;Table&gt;
          &lt;id&gt;100&lt;/id&gt;
          &lt;empname&gt;Joe Smith&lt;/empname&gt;
          &lt;phone&gt;111-111-1111&lt;/phone&gt;
          &lt;mobile&gt;222-222-2222&lt;/mobile&gt;
  
      &lt;/Table&gt;
      &lt;Table&gt;
          &lt;id&gt;101&lt;/id&gt;
          &lt;empname&gt;Ann Jensen&lt;/empname&gt;
          &lt;phone&gt;111-111-0000&lt;/phone&gt;
          &lt;mobile&gt;222-222-0000&lt;/mobile&gt;
      &lt;/Table&gt;
  &lt;NewDataSet&gt;
  </code></pre>
  
  <p>I want to convert it to the below structure. I am a newbie at xsl transforms and I am not sure how keep the <code>&lt;Table&gt;</code> element from repeating for every record in the dataset.</p>
  
  <pre><code>&lt;NewDataSet&gt;
      &lt;Table&gt;
          &lt;employee id="100"&gt;
              &lt;empname&gt;Joe Smith&lt;/empname&gt;
              &lt;phone&gt;111-111-1111&lt;/phone&gt;
              &lt;mobile&gt;222-222-2222&lt;/mobile&gt;
          &lt;/employee&gt;
          &lt;employee id="101"&gt;
              &lt;empname&gt;Ann Jensen&lt;/empname&gt;
              &lt;phone&gt;111-111-0000&lt;/phone&gt;
              &lt;mobile&gt;222-222-0000&lt;/mobile&gt;
          &lt;/employee&gt;
      &lt;/Table&gt;
  &lt;NewDataSet&gt;
  </code></pre>
  
  <p>I tried using a combination of xsl:for-each and xsl:if statements to get what I wanted, but so far I have not been able to get it to work. Any assistance would be greatly appreciated.</p>