title: How to just get plain text and line breaks using XSL
body: <p>With this input</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;data&gt; 
  This is a senstence   
  this is another sentence
  
  &lt;section&gt;
          &lt;!--comment --&gt;&lt;h2&gt;my H2&lt;/h2&gt;     &lt;p&gt;some paragraph&lt;/p&gt;             &lt;p&gt;another paragraph&lt;/p&gt;                 
      &lt;/section&gt; &lt;/data&gt;
  </code></pre>
  
  <p>I need to apply XSL style sheet to obtain just the plain text, honor the line breaks, and remove preceeding white space. So, after searching online for a few samples, I tried this, but it does not work for me. Sorry, Im not familiar with XSL and thought I'd ask.</p>
  
  <p>Attempted XSL, but it does not work. Any ideas?</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:output method="text" encoding="UTF-8"/&gt;
      &lt;xsl:strip-space elements="*" /&gt;
  
          &lt;xsl:template match ="@* | node()"&gt;
              &lt;xsl:copy&gt;
                  &lt;xsl:apply-templates select="@* | node()"/&gt;
              &lt;/xsl:copy&gt;    
          &lt;/xsl:template&gt;
  
          &lt;xsl:template match="h1|h2"&gt;
              &lt;xsl:text&gt;
              &lt;/xsl:text&gt;
              &lt;xsl:copy&gt;
                  &lt;xsl:apply-templates select="@* | node()"/&gt;
              &lt;/xsl:copy&gt;  
          &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>This is the output after applying XSL.
  As you can see, its all one line, not carriage returns.</p>
  
  <pre><code>This is a sentence this is another sentence m H2some paragraphTanother paragraph
  </code></pre>
  
  <p>This is the output I'd like to get. Text within H1|H2|H3 should have a line break before and after.</p>
  
  <pre><code>This is a sentence 
  this is another sentence 
  
  my H2
  
  some paragraph
  another paragraph
  </code></pre>