特定
带有全局变量的XSLT样式表:
<xsl:variable name="lang" select="/response/str[@name='lang']"/>
Run Code Online (Sandbox Code Playgroud)
题
从何而来,在谓词中使用变量的限制在xsl:template匹配模式中是不正确的,但在xsl:apply-templates选择模式时是否可以接受?
<!-- 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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9501 次 |
| 最近记录: |