0
我目前正在努力提高代码和我碰到这样的:模板匹配和测试是否存在语法差异?
<xsl:template match="activator">
<xsl:if test="not(ancestor::repeater)">
Test1
</xsl:if>
</xsl:template>
,因为如果不显得必要我取代了它:
<xsl:template match="activator[not(ancestor::repeater)]">
Test2
</xsl:template>
我
<?xml version="1.0" encoding="UTF-8"?>
<repeater>
<activator>
<text>
<string>T_Auswahl</string>
</text>
</activator>
</repeater>
测试它
但它现在不匹配,我无法弄清楚我做错了什么。
“*但它现在不匹配*”一个例子将是最有用的:http://stackoverflow.com/help/mcve –
重新添加测试:它现在不匹配,因为你没有祖先不是“中继器”的“激活器”节点。 –