Operators

The expression language includes a number of operators, which are used to perform calculations and comparisons. Operators give purpose to the functions described above, allowing the returned values to be compared with each other and with fixed values. Comparisons for equality, for inequality and for comparative size can be made.

Addition and subtraction ('+ and '-')

Numeric values can be added together using the '+' operator, and subtracted using '-':

<if test="0 + 1"><!-- ENABLED (1) --></if>

<if test="1 - 1"><!-- NOT ENABLED (0) --></if>

Note that, to avoid confusion with hyphens in names, the '-' symbol is recognized as a minus by adding whitespace before it:

test="first-node - second-node"

Equality and inequality ('=' and '!=') ...

Get XSL companion, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.