Usage of not and != in Xpath

4
Can anyone tell me the difference between the following two Xpath constraints: ReferenceA_B != [%CurrentObject%] and not(ReferenceA_B = [%CurrentObject%]) We've experienced different behaviour between these two constraints (both are valid obviously)
asked
1 answers
9

If the association from A to B is a reference set or a 1 : 0 reference, the constraints possibly apply to multiple objects (depending on the direction in which the association is traversed). In this case, there is a very distinct difference between the two constraints:

  • ReferenceA_B != [%CurrentObject%] means "There is at least one object that is not the current object" (which is true in most cases),
  • not(ReferenceA_B = [%CurrentObject%]) means "None of the objects is the current object".

So in the case of multiple objects, the choice between these constraints depends on what you want to achieve.

answered