Reputation: 16764
I tried to get all nodes except one provided by me, using XPath... The code:
UmbracoHelper.TypedContentAtXPath("//[not(contains(@alias, 'myNode1') or contains(@alias, 'myNode2'))]");
But I receive an error:
Expression must evaluate to a node-set.
Where is my mistake ?
Upvotes: 0
Views: 694
Reputation: 4257
I'm not sure if it's your intention, but your code there will do wildcard matches on doctype aliases. So it would match myNode1 on MyNode12. You could use something like this to do an exact match (the xpath is also slightly faster, as it's not using contains):
//*[self::myNode1 or self::myNode2]
Upvotes: 0
Reputation: 89285
You missed to specify element name to which the predicate (the expression within the square brackets) will be applied. It might be a specific name -which I don't know exactly- or a wildcard (*
, which means elements of any name) :
//*[not(contains(@alias, 'myNode1') or contains(@alias, 'myNode2'))]
Upvotes: 1