Anton Harald
Anton Harald

Reputation: 827

xpath: select everything except one node and all its subnodes

I am looking for an xpath query, that selects the whole document but without the tags with an attribute off="true" and all their subnodes!

The first I know how to manage:

//*[not(@off='true')]

But it still selects the subnodes..

would be really nice if someone can help me out!

greetings!

Upvotes: 1

Views: 303

Answers (1)

Tomalak
Tomalak

Reputation: 338118

//*[not(ancestor-or-self::*/@off = 'true')]

Upvotes: 1

Related Questions