functx:between-inclusive

Whether a value is between two provided values, or equal to one of them

Description

The functx:between-inclusive function returns true if the $value is between $minValue and $maxValue, inclusive. If the values are of incomparable types, an error will be raised. If $value is the empty sequence, the function returns false.

Parameters

Description

value:string()

the value to be tested

minValue:string()

the minimum value

maxValue:string()

the maximum value

Examples

XPath

Results

Explanation

functx:between-inclusive(55, 1, 1000)

true

55 is between 1 and 1000.

functx:between-inclusive(1, 1, 1000)

true

The limits are included, so 1 counts.

functx:between-inclusive(1200, 1, 1000)

false

1200 is greater than 1000.

functx:between-inclusive('b', 'b', 'd')

true

Strings are compared too; 'b' is equal to the lower limit.

functx:between-inclusive(xs:date('2004-10-31'), xs:date('2004-10-15'), xs:date('2004-11-01'))

true

Dates are compared too.

functx:between-inclusive('a', 1, 1000)

Error

Strings cannot be compared to integers.

See Also