title: XML to CSV with nested elements (xsltproc)
body: <p>I'm trying to convert a XML to CSV using xsltproc.</p>
  
  <p>I currently have</p>
  
  <pre><code>--XSL template
  &lt;xsl:strip-space elements="*" /&gt;
  
  &lt;xsl:template match="/*/child::*"&gt;
  &lt;xsl:for-each select="child::*"&gt;
  &lt;xsl:if test="position() != last()"&gt;"&lt;xsl:value-of select="normalize-space(.)"/&gt;",            &lt;/xsl:if&gt;
  &lt;xsl:if test="position()  = last()"&gt;"&lt;xsl:value-of select="normalize-space(.)"/&gt;"  &lt;xsl:text&gt;&amp;#xD;&lt;/xsl:text&gt;
  &lt;/xsl:if&gt;
  &lt;/xsl:for-each&gt;
  &lt;/xsl:template&gt;
  
  --XML (they are two separate files 
      &lt;root&gt;
  &lt;summary&gt;
      &lt;field1&gt;a&lt;/field1&gt;
      &lt;field2&gt;b&lt;/field2&gt;
      &lt;field3&gt;c&lt;/field3&gt;
      &lt;field4&gt;d&lt;/field4&gt;
          &lt;data&gt;
              &lt;field5&gt;e&lt;/field5&gt;
              &lt;field6&gt;f&lt;/field6&gt;
          &lt;/data&gt;
          &lt;user_info&gt;
              &lt;field7&gt;g&lt;/field7&gt;
              &lt;field8&gt;h&lt;/field8&gt;
          &lt;/user_info&gt;
     &lt;/summary&gt;
   &lt;/root&gt;
  </code></pre>
  
  <p>But how to i include nested elements from the XML? I have 3 nested elements.</p>
  
  <p>Currently i am getting
  "field one", "field two", "field three", "field four", "field 5,6,7,8,9,10"</p>
  
  <p>I'd like to see</p>
  
  <pre><code>field1, field 2, field 3, field 4, field 5, field 6, field 7, field 8
  "a", "b", "c", "d", "e", "f", "g", "h"
  </code></pre>