title: How to process result of previous xsl template in the xsl chain
body: <p>I have the following XSLT structure:</p>
  
  <p>1) xml file which I want to process with XSLT:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ul&gt;
      &lt;li style="xx"&gt;option1&lt;/li&gt;
      &lt;li style="yy"&gt;option2&lt;/li&gt;
      &lt;li style="zz"&gt;option3&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>2) main XSLT template which calls two other templates:</p>
  
  <pre><code>...
      &lt;xsl:include href="template1.xsl"/&gt;
      &lt;xsl:include href="template2.xsl"/&gt;
      &lt;xsl:template match="*"&gt;
          &lt;xsl:call-template name="template1"/&gt;   
          &lt;xsl:call-template name="template2"/&gt;
      &lt;/xsl:template&gt;
  ...
  </code></pre>
  
  <p>3) the first template(template1.xsl) is:</p>
  
  <pre><code>&lt;xsl:template name="template1"&gt;
      &lt;xsl:apply-templates/&gt;
  &lt;/xsl:template&gt;
  &lt;xsl:template match="//ul"&gt;        
      &lt;xsl:copy&gt;            
          &lt;xsl:for-each select="@*"&gt;
              &lt;xsl:copy/&gt;
          &lt;/xsl:for-each&gt;      
          &lt;li&gt;added option&lt;/li&gt;
          &lt;xsl:apply-templates/&gt;
       &lt;/xsl:copy&gt;     
  &lt;/xsl:template&gt;
  </code></pre>
  
  <p>4) the second(template2.xsl) is:</p>
  
  <pre><code>   &lt;xsl:template name="template2"&gt;
          &lt;xsl:apply-templates/&gt;
     &lt;/xsl:template&gt;
     &lt;xsl:template match="//ul/li"&gt;        
          &lt;xsl:copy&gt;            
              &lt;xsl:for-each select="@*"&gt;
                  &lt;xsl:copy/&gt;
              &lt;/xsl:for-each&gt;     
              &lt;xsl:text&gt;PREFIX &lt;/xsl:text&gt;
              &lt;xsl:apply-templates/&gt;
          &lt;/xsl:copy&gt;     
      &lt;/xsl:template&gt;
  </code></pre>
  
  <p>I expect that output XML file will contain four <code>&lt;li&gt;</code> tags where 'added option' should be the first and all <code>&lt;li&gt;</code> tags should contain prefix "PREFIX ", but instead I got:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ul&gt;
      &lt;li&gt;added option&lt;/li&gt;
      &lt;li style="xx"&gt;PREFIX option1&lt;/li&gt;
      &lt;li style="yy"&gt;PREFIX option2&lt;/li&gt;
      &lt;li style="zz"&gt;PREFIX option3&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>So the problem is that the first element is added but 'template2' doesn't work for it. 
  Could you please advise why this happens and how should I change my XSLT templates?</p>