XPath operator “!=”. How does it work?

Recommendation: Never use the != operator to compare inequality where one or both arguments are node-sets.

By definition the expression:

$node-set != $value

evaluates to true() exactly when there is at least one node in $node-set such that its string value is not equal to the string value of $value.

Using this definition:

$empty-nodeset != $value 

is always false(), because there isn’t even a single node in $empty-nodeset for which the inequality holds.

Solution:

Use:

not($node-set = $value)

Then you get all results true(), as wanted.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)