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 –
重新添加測試:它現在不匹配,因爲你沒有祖先不是「中繼器」的「激活器」節點。 –