UnaryExpr

Change the sign of a number.


Syntax

UnaryExpr

- SetExpr

Description

The UnaryExpr is a unary operator which changes the sign of a Number. It takes as argument a SetExpr which may also be a node set. In that case, it tries to convert the value of the respective node of the last document in the result set into a numeric value and changes the sign of that number

Compatibility

It corresponds to the expression UnaryExpr defined in XPath, Section 2.4, Rule 3.

Examples

  • This is simply a Number, the numeric value -3.

    -3
  • Change the sign of the numeric value -3.

    -(-3)
  • Subtract the year of birth of the last patient from the numeric value -2001 (no application of UnaryExpr):

    -2001-patient/born
  • Subtract the year of birth of the last patient from 2001 and change it in a negative value:

    -(2001-patient/born)

Related Expressions

AdditiveExpr