title: XSLT enumerate each child element
body: <p>I am trying to create a super generic XSLT that basically can only count on the table &amp; row elements being there. I have the following sample XML I am trying to make an XSLT for: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;table&gt;
      &lt;row&gt;
          &lt;id&gt;5311&lt;/id&gt;
          &lt;status&gt;Active&lt;/status&gt;
          &lt;id_vendor&gt;Verizon&lt;/id_vendor&gt;
          &lt;mobile_number&gt;555123456&lt;/mobile_number&gt;
      &lt;/row&gt;
      &lt;row&gt;
          &lt;id&gt;5312&lt;/id&gt;
          &lt;status&gt;Inactive&lt;/status&gt;
          &lt;id_vendor&gt;Sprint&lt;/id_vendor&gt;
          &lt;mobile_number&gt;555123457&lt;/mobile_number&gt;
      &lt;/row&gt;
      &lt;row&gt;
          &lt;id&gt;5313&lt;/id&gt;
          &lt;status&gt;Active&lt;/status&gt;
          &lt;id_vendor&gt;ATT&lt;/id_vendor&gt;
          &lt;mobile_number&gt;555123458&lt;/mobile_number&gt;
      &lt;/row&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The problem is that I do not know what the fields are going to end up being (id, status, id_vendor, mobile_number, etc. are all subject to change.</p>
  
  <p>I want to make pleasant to look at view such as:</p>
  
  <pre><code>&lt;div style="background-color:#E3CA87;padding:.2em"&gt;
      &lt;div style="background-color:#F1E2BB;padding:.2em"&gt;
          &lt;div&gt;id: x&lt;div&gt;
          &lt;div&gt;status: active&lt;div&gt;
          &lt;div&gt;id_vendor: Verizon&lt;div&gt;
          &lt;div&gt;mobile_number: 555123456&lt;div&gt;
      &lt;div&gt;
  &lt;div&gt;
  </code></pre>
  
  <p>Here is what I have so far.. but I can't get the anonymous elements going right:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;body style="background-color:#eee;font-size:12pt;font-family:Arial;"&gt;
      &lt;xsl:for-each select="table/row"&gt;
        &lt;div style="background-color:#eee;padding:.5em"&gt;
  
         &lt;xsl:for-each select="/*"&gt;
  
         &lt;div style="background-color:#E3CA87;padding:.2em;border: 1px solid black"&gt;
          &lt;xsl:for-each select="./*"&gt;
            &lt;div style="background-color:#F1E2BB;padding:.2em"&gt;
  &lt;xsl:value-of select ="name(./*)"/&gt;: 
  &lt;xsl:value-of select="*" /&gt;
            &lt;/div&gt;
          &lt;/xsl:for-each&gt;
        &lt;/div&gt;
      &lt;/xsl:for-each&gt;
        &lt;/div&gt;
      &lt;/xsl:for-each&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>