开发者

XSL For-Each exclusion by ID

开发者 https://www.devze.com 2023-02-11 08:37 出处:网络
I\'ve got an XSL issue.开发者_如何学Go With the following code I exclude Box1 <xsl:for-each select=\"//box[@id!=\'box1\']\">

I've got an XSL issue.开发者_如何学Go With the following code I exclude Box1

<xsl:for-each select="//box[@id!='box1']">

But I also want to exclude Box7. Is that possible and how can I do that?


You can AND those predicates together:

<xsl:for-each select="//box[@id!='box1'][@id!='box7']">


Use:

//box[not(@id='box1') and not(@id='box2')]

If you have many ids to exclude, use (in this example I am excluding "box1" - "box4"):

//box[not(contains('|box1|box2|box3|box4|', concat('|', @id, '|'))]
0

精彩评论

暂无评论...
验证码 换一张
取 消