title: Using XSLT to template a list within a paragraph, without losing the surrounding paragraph
body: <p>I need to use XSLT to transform XML of the following form (I have no control over the format of the XML itself, so I couldn't tell you why the list is formatted the way it is): </p>
  
  <pre><code>&lt;p id="p-0005" num="0004"&gt;Here is a statement and these are my reasons:
      &lt;ul id="ul0001" list-style="none"&gt;
          &lt;li id="ul0001-0001" num="0000"&gt;
              &lt;ul id="ul0002" list-style="none"&gt;
                  &lt;li id="ul0002-0001" num="0005"&gt;a. Reason number 1.&lt;/li&gt;
                  &lt;li id="ul0002-0002" num="0006"&gt;b. Reason number 2.&lt;/li&gt;
                  &lt;li id="ul0002-0003" num="0007"&gt;c. Reason number 3.&lt;/li&gt;
              &lt;/ul&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>I only have a few hours of XSLT experience, and so far I can extract the whole paragraph list and all:</p>
  
  <pre><code>&lt;xsl:template match="p"&gt;
      &lt;p&gt;
          &lt;xsl:value-of select="."/&gt;
      &lt;/p&gt;
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>or I've been able to extract only the list, without the sentence(s) preceding it:</p>
  
  <pre><code>&lt;xsl:template match="p"&gt;
      &lt;ul style="list-style: none;"&gt;
          &lt;xsl:for-each select="./ul/li/ul/li"&gt;
              &lt;li&gt;
                  &lt;xsl:value-of select="."/&gt;
              &lt;/li&gt;
          &lt;/xsl:for-each&gt;
      &lt;/ul&gt;
  &lt;/xsl:template&gt; 
  </code></pre>
  
  <p>What I want to do is end up with HTML equivalent of:</p>
  
  <pre><code>&lt;p&gt; Here is a statement I am making and these are my reasons
      &lt;ul&gt;
          &lt;li&gt; Reason number 1. &lt;/li&gt;
          &lt;li&gt; Reason number 2. &lt;/li&gt;
          &lt;li&gt; Reason number 3. &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/p&gt;
  </code></pre>
  
  <p>I've messed around with <code>&lt;xsl:apply-templates/&gt;</code> elements, but no matter what I try I end up with either missing or duplicate information. Any help is much appreciated!</p>