title: different excel layout transforming from xml
body: <p>i having a issue obtaining a repeated value on different excel cell using a transformation from a XML data.
  xml data that i want to report on each excel row are the VALUE of NAME contains string TYPE LINK and VER.
  The only way that i have to distinct the data between all are the progressive DATA-S01 number.
  Here is the wrong output generated after transformatio <a href="https://i.stack.imgur.com/oIRyV.png" rel="nofollow noreferrer">wrong data</a> but in short, I expected this <img src="https://i.stack.imgur.com/sj9xn.png" alt="expected data"></p>
  
  <p>My XML data </p>
  
  <pre><code>   &lt;FILE EXTNAME="TEST"&gt;
  
          &lt;VAR NAME="DATA-S01-TYPE" VALUE="A" /&gt;
          &lt;VAR NAME="DATA-S01-LINK" VALUE="123" /&gt;
          &lt;VAR NAME="DATA-S01-VER" VALUE="RED" /&gt;
          &lt;VAR NAME="DATA-S02-TYPE" VALUE="B" /&gt;  
          &lt;VAR NAME="DATA-S02-LINK" VALUE="987" /&gt;
          &lt;VAR NAME="DATA-S02-VER" VALUE="BLUE" /&gt;
  
      &lt;/FILE&gt;
  </code></pre>
  
  <p>and my xslt</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns="urn:schemas-microsoft-com:office:spreadsheet"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  xmlns:user="urn:my-scripts" xmlns:o="urn:schemas-microsoft-com:office:office"
  xmlns:x="urn:schemas-microsoft-com:office:excel"
  xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"&gt;
  &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt;
  &lt;xsl:param name="separator" select="'&amp;#x9;'"/&gt;
  
  &lt;xsl:template match="/"&gt;
      &lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
          xmlns:o="urn:schemas-microsoft-com:office:office"
          xmlns:x="urn:schemas-microsoft-com:office:excel"
          xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
          xmlns:html="http://www.w3.org/TR/REC-html40"&gt;
          &lt;xsl:apply-templates/&gt;
      &lt;/Workbook&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="/*"&gt;
      &lt;Worksheet&gt;
          &lt;xsl:attribute name="ss:Name"&gt;
              &lt;xsl:value-of select="local-name(/*/*)"/&gt;
          &lt;/xsl:attribute&gt;
  
          &lt;Table x:FullColumns="1" x:FullRows="1"&gt;
              &lt;xsl:for-each select="//FILE"&gt;
                  &lt;Row&gt;
                      &lt;Cell&gt;
                          &lt;Data ss:Type="String"&gt;
                              &lt;xsl:value-of select="@EXTNAME"/&gt;
  
                          &lt;/Data&gt;
                      &lt;/Cell&gt;
                  &lt;/Row&gt;
                  &lt;xsl:for-each select="VAR[contains(@NAME, 'TYPE')]/@VALUE"&gt;
                      &lt;Row&gt;
                          &lt;Cell&gt;
                              &lt;Data ss:Type="String"&gt;
                                  &lt;xsl:value-of select="."/&gt;
  
                              &lt;/Data&gt;
                          &lt;/Cell&gt;
  
                          &lt;xsl:for-each select="//VAR[contains(@NAME, 'VER')]/@VALUE"&gt;
                              &lt;Cell&gt;
                                  &lt;Data ss:Type="String"&gt;
                                      &lt;xsl:value-of select="."/&gt;
  
                                  &lt;/Data&gt;
                              &lt;/Cell&gt;
                          &lt;/xsl:for-each&gt;
                          &lt;xsl:for-each select="//VAR[contains(@NAME, 'LINK')]/@VALUE"&gt;
                              &lt;Cell&gt;
                                  &lt;Data ss:Type="String"&gt;
                                      &lt;xsl:value-of select="."/&gt;
  
                                  &lt;/Data&gt;
                              &lt;/Cell&gt;
                          &lt;/xsl:for-each&gt;
  
                      &lt;/Row&gt;
  
                  &lt;/xsl:for-each&gt;
  
              &lt;/xsl:for-each&gt;
              &lt;xsl:apply-templates/&gt;
          &lt;/Table&gt;
      &lt;/Worksheet&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>Have any idea where I'm wrong?</p>