title: XSLT: How do I match every descendant individually?
body: <p>I am attempting to flatten the following XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;root xmlns="http://pretend.namespace"&gt;
      &lt;record&gt;
          &lt;first&gt;1&lt;/first&gt;
          &lt;second&gt;2&lt;/second&gt;
          &lt;tricky&gt;
              &lt;taxing&gt;3&lt;/taxing&gt;
              &lt;mayhem&gt;
                  &lt;ohno&gt;4&lt;/ohno&gt;
                  &lt;boom&gt;5&lt;/boom&gt;
              &lt;/mayhem&gt;
          &lt;/tricky&gt;
      &lt;/record&gt;
      &lt;record&gt;
          &lt;first&gt;1&lt;/first&gt;
          &lt;second&gt;2&lt;/second&gt;
          &lt;tricky&gt;
              &lt;taxing&gt;3&lt;/taxing&gt;
              &lt;mayhem&gt;
                  &lt;ohno&gt;4&lt;/ohno&gt;
                  &lt;boom&gt;5&lt;/boom&gt;
              &lt;/mayhem&gt;
          &lt;/tricky&gt;
      &lt;/record&gt;
      &lt;record&gt;
          &lt;first&gt;1&lt;/first&gt;
          &lt;second&gt;2&lt;/second&gt;
          &lt;tricky&gt;
              &lt;taxing&gt;3&lt;/taxing&gt;
              &lt;mayhem&gt;
                  &lt;ohno&gt;4&lt;/ohno&gt;
                  &lt;boom&gt;5&lt;/boom&gt;
              &lt;/mayhem&gt;
          &lt;/tricky&gt;
      &lt;/record&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>into one row-per record, discarding the complex structure within the records.</p>
  
  <pre><code>1,2,3,4,5
  1,2,3,4,5
  1,2,3,4,5
  </code></pre>
  
  <p>using this XSLT</p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:p="http://pretend.namespace"&gt;
  
  &lt;xsl:strip-space elements="*"/&gt; &lt;!-- remove unwanted whitespace? --&gt;
  
   &lt;!-- Match every p:record --&gt;
  &lt;xsl:template match="p:record"&gt;
      &lt;xsl:apply-templates/&gt; &lt;!-- now we're inside a &lt;record&gt; do what you can with the contents then give a line return --&gt;
      &lt;xsl:text&gt;&amp;#xA;&lt;/xsl:text&gt;&lt;!-- this is a line return --&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="p:record//*"&gt;
      &lt;xsl:value-of select="."&gt;&lt;/xsl:value-of&gt;&lt;xsl:text&gt;,&lt;/xsl:text&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="text()"/&gt; &lt;!-- WORKS: prevents "default output" to aid debugging --&gt;
  
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>but despite hours of trying I cannot get it to visit each descendant and comma-separate them all, and I get this:</p>
  
  <pre><code>1,2,345,
  1,2,345,
  1,2,345,
  </code></pre>
  
  <p>What do I need to do to get it to treat all the grandchildren and below individually? (The final comma per line isn't an issue)</p>
  
  <p>Thank you!</p>
  
  <p>EDIT: The discussion following this question indicated that Dr. Herong Yang's XML Tools for Notepad++ <em>appears</em> to only support XSLT 1.0</p>