在xslt中的模板匹配中编写和条件

Pat*_*tan 2 xslt

在模板匹配中实现和条件

       <xsl:template match="a[!(img)and(not(@id))]">
Run Code Online (Sandbox Code Playgroud)

我想写一个这样的模板

       a tag should not have attribute id and should not be followed by img tag.
Run Code Online (Sandbox Code Playgroud)

但它显示错误.任何人都可以帮忙

Fré*_*idi 7

假设followed by img tag是指孩子而不是兄弟姐妹,你只需要巩固你对not()函数的使用,而不是不支持的!运算符:

<xsl:template match="a[not(img) and not(@id)]">
    <!-- ... -->
</xsl:template>
Run Code Online (Sandbox Code Playgroud)