title: Transform XML to HTML using XSL issue selecting dynamically all child nodes based on attribute value
body: <p>I am trying to use XSL to present an XML report as HTML.
  XSL does not return errors as per the format or anything(checked using Altova XMLSpy application) but does not provide the correct html table I am expecting.
  Below is my XML code and my XSL code.
  What I need, because my XML node/tag <code>&lt;row&gt;&lt;/row&gt;</code> does not always have <code>&lt;key&gt;</code> tags or <code>&lt;value&gt;</code> tags but it can be different for time to time, is to list all those child tags using xsl to html table dynamically whatever the case is.
  For example below I want to produce an HTML table with rows the numbers of the rows and for each row to have the columns listed which will be in this case:</p>
  
  <blockquote>
    <p>column 1 = Institution_Id<br>
    column 2= Section<br>
    column 3= CATEGORY<br>
    column 4= SUBCATEGORY<br>
    column 5= ITEM<br>
    *column 6= VALUE<br>
     column7= SHORTCODE</p>
  </blockquote>
  
  <p>and the rows should be</p>
  
  <blockquote>
    <p>1<br>
     2<br>
     .<br>
     .
     8<br>
     9<br>
     .<br>
     .<br>
     .  </p>
  </blockquote>
  
  <p>ps: * as you can see from the xml the column 6 is not the same tag name as the rest <code>&lt;key&gt;</code> vs <code>&lt;value&gt;</code> this can be done with other cases like have <code>&lt;key&gt;</code> vs <code>&lt;item&gt;</code>.</p>
  
  <p>XML code:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="ParamStyleSTAVROS.xsl"?&gt;
  &lt;Report&gt;
  &lt;Header&gt;&lt;/Header&gt;
  &lt;Results Property="Comparison Results"&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;key column="Institution_Id" left="CNTR"/&gt;
          &lt;key column="Institution_Id" right="CNTR"/&gt;
      &lt;/row&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;key column="SECTION" left="AMEX"/&gt;
          &lt;key column="SECTION" right="AMEX"/&gt;
      &lt;/row&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;key column="CATEGORY" left="reason codes"/&gt;
          &lt;key column="CATEGORY" right="reason codes"/&gt;
      &lt;/row&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;key column="SUBCATEGORY" left="exception reason codes"/&gt;
          &lt;key column="SUBCATEGORY" right="exception reason codes"/&gt;
      &lt;/row&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;key column="ITEM" left="3000 - Lost card"/&gt;
          &lt;key column="ITEM" right="3000 - Lost card"/&gt;
      &lt;/row&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;value column="VALUE" left="3000"/&gt;
          &lt;value column="VALUE" right="3000.0"/&gt;
      &lt;/row&gt;
      &lt;row number="1" type="equal"&gt;
          &lt;key column="SHORTCODE" left="DEFP"/&gt;
          &lt;key column="SHORTCODE" right="DEFP"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;key column="Institution_Id" left="CNTR"/&gt;
          &lt;key column="Institution_Id" right="CNTR"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;key column="SECTION" left="AMEX"/&gt;
          &lt;key column="SECTION" right="AMEX"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;key column="CATEGORY" left="reason codes"/&gt;
          &lt;key column="CATEGORY" right="reason codes"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;key column="SUBCATEGORY" left="exception reason codes"/&gt;
          &lt;key column="SUBCATEGORY" right="exception reason codes"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;key column="ITEM" left="3001 - Stolen Card"/&gt;
          &lt;key column="ITEM" right="3001 - Stolen Card"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;value column="VALUE" left="3001"/&gt;
          &lt;value column="VALUE" right="3001.0"/&gt;
      &lt;/row&gt;
      &lt;row number="2" type="equal"&gt;
          &lt;key column="SHORTCODE" left="DEFP"/&gt;
          &lt;key column="SHORTCODE" right="DEFP"/&gt;
      &lt;/row&gt;
      .
      .
      .
      .
      .
      .
      &lt;row number="8" type="orphaned"&gt;
          &lt;key column="Institution_Id" left=""/&gt;
          &lt;key column="Institution_Id" right="CNTR"/&gt;
      &lt;/row&gt;
      &lt;row number="8" type="orphaned"&gt;
          &lt;key column="SECTION" left=""/&gt;
          &lt;key column="SECTION" right="AMEX"/&gt;
      &lt;/row&gt;
      &lt;row number="8" type="orphaned"&gt;
          &lt;key column="CATEGORY" left=""/&gt;
          &lt;key column="CATEGORY" right="Statistics"/&gt;
      &lt;/row&gt;
      &lt;row number="8" type="orphaned"&gt;
          &lt;key column="SUBCATEGORY" left=""/&gt;
          &lt;key column="SUBCATEGORY" right="Product"/&gt;
      &lt;/row&gt;
      &lt;row number="8" type="orphaned"&gt;
          &lt;key column="ITEM" left=""/&gt;
          &lt;key column="ITEM" right="product line"/&gt;
      &lt;/row&gt;
      &lt;row number="8" type="orphaned"&gt;
          &lt;value column="VALUE" left=""/&gt;
          &lt;value column="VALUE" right="NULL"/&gt;
      &lt;/row&gt;
      &lt;row number="8" type="orphaned"&gt;
          &lt;key column="SHORTCODE" left=""/&gt;
          &lt;key column="SHORTCODE" right="DEFP"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;key column="Institution_Id" left=""/&gt;
          &lt;key column="Institution_Id" right="CNTR"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;key column="SECTION" left=""/&gt;
          &lt;key column="SECTION" right="AMEX"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;key column="CATEGORY" left=""/&gt;
          &lt;key column="CATEGORY" right="Statistics"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;key column="SUBCATEGORY" left=""/&gt;
          &lt;key column="SUBCATEGORY" right="Product"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;key column="ITEM" left=""/&gt;
          &lt;key column="ITEM" right="product name"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;value column="VALUE" left=""/&gt;
          &lt;value column="VALUE" right="NULL"/&gt;
      &lt;/row&gt;
      &lt;row number="9" type="orphaned"&gt;
          &lt;key column="SHORTCODE" left=""/&gt;
          &lt;key column="SHORTCODE" right="DEFP"/&gt;
      &lt;/row&gt;
      .
      .
      .
      .
      .
      .
      .
  &lt;/Results&gt;
  &lt;/Report&gt;
  </code></pre>
  
  <p>XSL code:</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0"  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
  &lt;xsl:output method="html" indent="yes"/&gt;
  &lt;xsl:template match="/Report/Header"&gt;
  
  &lt;html&gt;
  &lt;style&gt;
  h1{
  font-family: Gill Sans, Verdana;
  font-size: 11px;
  line-height: px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
  }
  table,th,td{
  font-family: Gill Sans, Verdana;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: bold;
  border: 1px solid black;
  border-collapse: collapse;
  width:100%;
  }
  td{
  font-size: 11px;
  padding:5px;
  }
  th{
  font-size: 18px;
  height: 20px;
  padding:5px;
  background-color: yellow;
  color: black;
  }
  
  
  &lt;/style&gt;
  
  &lt;head&gt;
      &lt;h1&gt;Comparison Report Information&lt;/h1&gt;
          &lt;table&gt;
              &lt;th&gt;ReportCreated&lt;/th&gt;
              &lt;th&gt;Product&lt;/th&gt;
              &lt;th&gt;PrimaryDB&lt;/th&gt;
              &lt;th&gt;PrimaryDBMS&lt;/th&gt;
              &lt;th&gt;SecondaryDB&lt;/th&gt;    
              &lt;th&gt;SecondaryDBMS&lt;/th&gt;  
          &lt;tr&gt;
              &lt;xsl:for-each select="Property"&gt;
              &lt;td&gt;
              &lt;xsl:value-of select="@*"&gt;&lt;/xsl:value-of&gt;
              &lt;/td&gt;
              &lt;/xsl:for-each&gt;
          &lt;/tr&gt;
  
          &lt;/table&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
          &lt;h1&gt;Results&lt;/h1&gt;
          &lt;br&gt;&lt;/br&gt;
  &lt;table&gt;
  
      &lt;xsl:for-each select="row/@number"&gt;
          &lt;tr&gt;
              &lt;xsl:for-each select="row"&gt;
                  &lt;th&gt;
                      &lt;xsl:value-of select="@*"&gt;&lt;/xsl:value-of&gt;       
                  &lt;/th&gt;
              &lt;/xsl:for-each&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;xsl:value-of select="."&gt;&lt;/xsl:value-of&gt;        
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/xsl:for-each&gt;
  &lt;/table&gt;
  
  &lt;/body&gt;
   &lt;/html&gt;
  &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>