title: Variable in xsl:template matching pattern
body: <p><strong>Given</strong></p>
  
  <p>An XSLT stylesheet with a global variable:</p>
  
  <pre><code>&lt;xsl:variable name="lang" select="/response/str[@name='lang']"/&gt;
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>Where from comes the limitation that using variables in predicates is incorrect in the <code>xsl:template</code> matching pattern, but is acceptable in <code>xsl:apply-templates</code> selecting pattern?</p>
  
  <pre><code>&lt;!-- throws compilation error, at least in libxslt --&gt; 
  &lt;xsl:template match="list[@name='item_list'][$lang]"/&gt;
  
  &lt;!-- works as expected --&gt; 
  &lt;xsl:template match="list[@name='item_list'][/response/str[@name='lang']]"/&gt;
  
  &lt;!-- works as expected --&gt; 
  &lt;xsl:template match="response"&gt;
      &lt;xsl:apply-templates select="list[@name='item_list'][$lang]"&gt;
  &lt;/xsl:template&gt;
  </code></pre>