title: XSLT: in a <p> element, how to replace a line break (<br/>) with successive <alinea> element?
body: <p>I am trying to transform a <code>&lt;p&gt;</code> element with <code>&lt;br/&gt;</code> elements within into several <code>&lt;alinea&gt;subtext&lt;/alinea&gt;</code>. For instance : </p>
  
  <pre><code>&lt;p&gt;subtext&lt;br/&gt;some more text&lt;br/&gt; some more subtext&lt;/p&gt;
  </code></pre>
  
  <p>From the previous <code>&lt;p&gt;</code> I was hoping to simply replace all <code>&lt;br/&gt;</code> into <code>&lt;/alinea&gt;&lt;alinea&gt;</code> since the template for <code>&lt;p&gt;</code> opens a <code>&lt;alinea&gt;</code> element already.</p>
  
  <pre><code>&lt;xsl:template match="p"&gt;
      &lt;para&gt;&lt;alinea&gt;&lt;xsl:apply-templates/&gt;&lt;/alinea&gt;&lt;/para&gt;
  &lt;/xsl:template&gt;
  
  &lt;xsl:template match="br"&gt;
      &lt;/alinea&gt;&lt;xsl:apply-templates/&gt;&lt;alinea&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>But it is doesn't validate.</p>
  
  <p>Expected result : </p>
  
  <pre><code>&lt;para&gt;
     &lt;alinea&gt;
       subtext
     &lt;/alinea&gt;
     &lt;alinea&gt;
       some more text
     &lt;/alinea&gt;
     &lt;alinea&gt;
       some more subtext
     &lt;/alinea&gt;
   &lt;/para&gt;
  </code></pre>