title: Using XSLT to transform XML into Excel File
body: <p>Before anything i'm kind of new to XSLT , i've been asked to transform a XML file into an Excel file.</p>
  
  <p>After of couple hours playing around with xslt i've came up with this.</p>
  
  <p>This is a sample of my XML i've blured some information with *** since it's important stuff!</p>
  
  <pre><code>&lt;RELATORIO&gt;
    &lt;LANG&gt;PT&lt;/LANG&gt;
    &lt;MODULO&gt;
      &lt;NAME&gt;ObtemIdentificacao_P&lt;/NAME&gt;
      &lt;VALUES&gt;
        &lt;ROW&gt;
          &lt;Cae1&gt;46740&lt;/Cae1&gt;
          &lt;Cae2 /&gt;
          &lt;Cae3 /&gt;
          &lt;CodCP&gt;***&lt;/CodCP&gt;
          &lt;Concelho&gt;SINTRA&lt;/Concelho&gt;
          &lt;DataInvestigacao&gt;20160418&lt;/DataInvestigacao&gt;
          &lt;DescricaoCP&gt;SINTRA&lt;/DescricaoCP&gt;
          &lt;Distrito&gt;LISBOA&lt;/Distrito&gt;
          &lt;Email&gt;info@wurth.pt&lt;/Email&gt;
          &lt;Fax1&gt;*****&lt;/Fax1&gt;
          &lt;Fax2&gt;****&lt;/Fax2&gt;
          &lt;Fax3 /&gt;
          &lt;Internet&gt;www.wurth.pt&lt;/Internet&gt;
          &lt;Localidade /&gt;
          &lt;Moeda&gt;EURO&lt;/Moeda&gt;
          &lt;Morada&gt;Estrada Nacional - 249-4 - Abrunheira&lt;/Morada&gt;
          &lt;Nome&gt;WURTH (PORTUGAL)-TECNICA DE MONTAGEM LDA&lt;/Nome&gt;
          &lt;NumeroContribuinte&gt;****&lt;/NumeroContribuinte&gt;
          &lt;NumeroSine&gt;38358&lt;/NumeroSine&gt;
          &lt;pais&gt;174&lt;/pais&gt;
          &lt;Telefone1&gt;***&lt;/Telefone1&gt;
        &lt;/ROW&gt;
      &lt;/VALUES&gt;
    &lt;/MODULO&gt;
  &lt;/RELATORIO&gt;
  </code></pre>
  
  <p>Here's the XSLT i came up with </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:output omit-xml-declaration="no"/&gt;
    &lt;xsl:template match="/"&gt;
      &lt;xsl:processing-instruction name="mso-application"&gt;progid="Excel.Sheet"&lt;/xsl:processing-instruction&gt;
      &lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"&gt;
        &lt;Styles&gt;
          &lt;Style ss:ID="header" ss:Name="Normal"&gt;
            &lt;Font ss:FontName="Verdana" ss:Bold="1" /&gt;
          &lt;/Style&gt;
        &lt;/Styles&gt;
        &lt;Worksheet ss:Name="Identificacao"&gt;
          &lt;Table&gt;
            &lt;Row ss:Index="1"&gt;
              &lt;Cell ss:Index="1" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Nome&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="2" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Nº Sine&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="3" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Nº Contribuinte&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="4" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Distrito&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="5" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Concelho&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="6" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Código Postal&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="7" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Morada&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="8" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Telefone&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="9" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Email&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="10" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Fax&lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="11" ss:StyleID="header"&gt;
                &lt;Data ss:Type="String"&gt;Pais&lt;/Data&gt;
              &lt;/Cell&gt;
            &lt;/Row&gt;
            &lt;Row ss:Index="{position()}"&gt;
              &lt;Cell ss:Index="1"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Nome"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="2"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/NumeroSine"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="3"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/NumeroContribuinte"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="4"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Distrito"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="5"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Concelho"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="6"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/CodCP"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="7"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Morada"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="8"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Telefone1"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="9"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Email"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="10"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/Fax1"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
              &lt;Cell ss:Index="11"&gt;
                &lt;Data ss:Type="String"&gt;
                  &lt;xsl:value-of select="VALUES/ROW/pais"/&gt;
                &lt;/Data&gt;
              &lt;/Cell&gt;
            &lt;/Row&gt;
          &lt;/Table&gt;
        &lt;/Worksheet&gt;
      &lt;/Workbook&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>This XSLT does produce an Excel file but the only thing shown in the Excel are the Names of the Fields, like</p>
  
  <p>Nome | Nº Sine | Nº Contribuinte | Etc.. </p>
  
  <p>But no values are shown below the Fields.</p>
  
  <p>How do i get the values of the text inside the nodes to be shown in the Excel file?</p>
  
  <p>And if possible i wanted each field to have it's own row instead of being a Column.</p>