ValueComp

Compare single values.


Syntax

ValueComp

graphics/ValueComp.png

Expr Expr

Description

A value comparison compares two single items. Each operand is atomized so that it is either a single atomic value or an empty sequence. If one of the operands is atomized to an empty sequence, the result of the operation is also an empty sequence. If the atomized operand is a sequence of length greater than one, an error is raised.

If one of the operands is of the type xs:anySimpleType, that operand is cast to a required type which is determined as follows:

  • xs:double, if the type of the other operand is numeric

  • xs:string, if the type of the other operand is xs:anySimpleType

  • otherwise it is the type of the other operand

If the cast fails, a dynamic error is raised.

The result is true if the value of the first operand is equal, not equal, less than or equal, less, greater than, greater than or equal to the value of the second operand. Otherwise the result is false.

Example

  • Comparing two nodes with the same value, but different identities yields true:

    <a>42</a> eq <a>42</a>

Related Syntax Construct

The following construct(s) refer to this construct:

This construct is also related to the following construct(s):

GeneralComp