NodeComp

Compare two nodes.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

NodeComp

graphics/NodeComp.png

Expr Expr

Description

A NodeComp compares two nodes by their identity or by their document order. The following rules hold:

  1. Each operand must be either a single node or an empty sequence.

  2. If either operand is an empty sequence the result is an empty sequence.

  3. A comparison using the is operator yields true if the two operand nodes have the same identity, otherwise false is returned.

  4. A comparison using the << operator yields true if the left operand node precedes the right operand node in document order, otherwise false is returned.

  5. A comparison using the >> operator yields true if the left operand node follows the right operand node in document order, otherwise false is returned.

Example

  • The result of this comparison is false, because each node has its own identity (rule 3):

    <a>42</a> is </a>