title: XSL transform MS Access 2007 output
body: <p>I am exporting data from Access on regular basis. So far I used to export it and manually edit some tags to adjust it to Clients needs. Lately I found that that there is posibility to use XSL as a transformation pattern.</p>
  
  <p>I am still beginner when comes to XSL but managed to create something like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
  
  &lt;xsl:template match="@*|node()"&gt;
      &lt;xsl:copy&gt;
          &lt;xsl:apply-templates select="@*|node()"/&gt;
      &lt;/xsl:copy&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="dataroot/Kwerenda_x0020_Nota_x0020_Kredytowa"&gt;
      &lt;xsl:element name="Faktury_od_nas"&gt;
          &lt;xsl:apply-templates /&gt;
      &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Generally it works ok but:<br>
  1. Normally when I export data it gives me every tag in a new line, now it is divided only by tag I changed.<br>
  2. I do not know how to rename dataroot. I tried to copy/paste same code but then I get dataroot everytime Faktury_od_nas appears...</p>
  
  <p>Transformed sample data:</p>
  
  <pre><code>&lt;dataroot generated="2016-01-12T13:54:11" xmlns:od="urn:schemas-microsoft-com:officedata"&gt;&lt;Faktury_od_nas&gt;&lt;No&gt;1&lt;/No&gt;&lt;InvoiceDate&gt;20150715&lt;/InvoiceDate&gt;&lt;InvoiceNumber&gt;12345&lt;/InvoiceNumber&gt;&lt;CustVATNumber&gt;LT100004645417&lt;/CustVATNumber&gt;&lt;E100customerKey&gt;65-92&lt;/E100customerKey&gt;&lt;CustomerName&gt;Client_name&lt;/CustomerName&gt;&lt;InvoiceCountry&gt;BE&lt;/InvoiceCountry&gt;&lt;VATpersent&gt;21&lt;/VATpersent&gt;&lt;VATBasis&gt;106,36&lt;/VATBasis&gt;&lt;VATamount&gt;22,34&lt;/VATamount&gt;&lt;Currency&gt;EUR&lt;/Currency&gt;&lt;VAT_x0020_recovery_x0020_fee_x0020_rate_x0020__x0028__x0025__x0029_&gt;7.5&lt;/VAT_x0020_recovery_x0020_fee_x0020_rate_x0020__x0028__x0025__x0029_&gt;&lt;Service_x0020_Type&gt;Express&lt;/Service_x0020_Type&gt;&lt;InvoiceScanFileName&gt;scan_name&lt;/InvoiceScanFileName&gt;
      &lt;/Faktury_od_nas&gt;&lt;/dararoot&gt;
  </code></pre>
  
  <p>Desired sample data:</p>
  
  <pre><code>&lt;Faktura&gt;
  &lt;Faktury_od_nas&gt;
  &lt;No&gt;1&lt;/No&gt;
  &lt;InvoiceDate&gt;20150715&lt;/InvoiceDate&gt;
  &lt;InvoiceNumber&gt;12345&lt;/InvoiceNumber&gt;
  &lt;CustVATNumber&gt;LT100004645417&lt;/CustVATNumber&gt;
  &lt;E100customerKey&gt;65-92&lt;/E100customerKey&gt;
  &lt;CustomerName&gt;Client_name&lt;/CustomerName&gt;
  &lt;InvoiceCountry&gt;BE&lt;/InvoiceCountry&gt;
  &lt;VATpersent&gt;21&lt;/VATpersent&gt;
  &lt;VATBasis&gt;106,36&lt;/VATBasis&gt;
  &lt;VATamount&gt;22,34&lt;/VATamount&gt;
  &lt;Currency&gt;EUR&lt;/Currency&gt;
  &lt;VAT_x0020_recovery_x0020_fee_x0020_rate_x0020__x0028__x0025__x0029_&gt;7.5&lt;/VAT_x0020_recovery_x0020_fee_x0020_rate_x0020__x0028__x0025__x0029_&gt;
  &lt;Service_x0020_Type&gt;Express&lt;/Service_x0020_Type&gt;
  &lt;InvoiceScanFileName&gt;scan_name&lt;/InvoiceScanFileName&gt;
  &lt;/Faktury_od_nas&gt;
  &lt;/Faktura&gt;
  </code></pre>
  
  <p>I appreciate any help.</p>
  
  <p>Edit:</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" /&gt;
  
  &lt;xsl:template match="*"&gt;
      &lt;xsl:element name="{local-name()}"&gt;
          &lt;xsl:apply-templates/&gt;
      &lt;/xsl:element&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="dataroot"&gt;
      &lt;Faktura&gt;
          &lt;xsl:apply-templates /&gt;
      &lt;/Faktura&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="Kwerenda_x0020_Nota_x0020_Kredytowa"&gt;
      &lt;Faktury_od_nas&gt;
          &lt;xsl:apply-templates /&gt;
      &lt;/Faktury_od_nas&gt;
  &lt;/xsl:template&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>