tags:

views:

142

answers:

1

The following xpath query gets nodes except where the ancestor is a particular type:

(/def:Image|…|//def:TextBox)[not(ancestor::clpm:EditableText)]

However, I want to be able to exclude all nodes that have an ancestor that is in the clpm namespace.

Can't work it out guys, any ideas?

Thanks

+1  A: 

Use the following as predicate:

not(ancestor::*[starts-with(name(),'clpm:')])

Do note, however, that namespace and prefix are quite different things. In a single XML document many different prefixes may be bound to the same namespace and a single prefix may be bound (redefined) to more than one namespace.

In your question you say namespace, when you mean prefix.

The XPath expression above is true if the current node doesn't have any ancestors with prefix clpm.

Dimitre Novatchev