Amra
Amra

Reputation: 25180

xpath for-each multiple conditions

What is wrong with the following line?

<xsl:for-each select="//Node1/Node2/Node3 [.!='Primary' or .!='Secondary' ]">

Trying to select all elements where Node3 is not Primary o Secondary.

Thanks.

Upvotes: 2

Views: 1801

Answers (2)

Dimitre Novatchev
Dimitre Novatchev

Reputation: 243469

not(. = 'Primary' or . = 'Secondary')

:)

Upvotes: 0

Lachlan Roche
Lachlan Roche

Reputation: 25956

I think you want to find Node3 where the content is not Primary and not Secondary.

<xsl:for-each select="//Node1/Node2/Node3[.!='Primary' and .!='Secondary' ]">

Upvotes: 2

Related Questions