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