XSLT 与某些属性不匹配 [英] XSLT do not match certain attributes
本文介绍了XSLT 与某些属性不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以匹配不属于属性子集的属性?例如,我想匹配除@attr1 和@attr2 之外的所有内容.有没有一种方法可以编写类似于以下内容的模板匹配语句,或者我是否以错误的方式进行处理?
Is it possible to match attributes that do not belong to a subset of attributes? For example, I would like to match everything but @attr1 and @attr2. Is there a way to write a template match statement similar to the following, or am I going about this the wrong way?
<xsl:template match="NOT(@attr1) and NOT(@attr2)">
谢谢
推荐答案
最简单的方法是使用两个模板:
The easiest way would be to use two templates:
<xsl:template match="@attr1|@attr2"/>
<xsl:template match="@*">
....
</xsl:template>
第一个模板将捕获对您想要忽略的那些引用的引用,然后简单地吃它们.第二个将匹配剩余的属性.
The first template will catch the references to those you want to ignore, and simply eat them. The second will match the remaining attributes.
这篇关于XSLT 与某些属性不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文