home contribute faq download

FunctX XQuery Functions

functx:between-inclusive

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

Google
Webxqueryfunctions.com

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.

Arguments and Return Type

NameTypeDescription
$value xs:anyAtomicType? the value to be tested
$minValue xs:anyAtomicType the minimum value
$maxValue xs:anyAtomicType the maximum value
return value xs:boolean

XQuery Function Declaration

See XSLT definition.
declare namespace functx = "http://www.functx.com";
declare function functx:between-inclusive
  ( $value as xs:anyAtomicType? ,
    $minValue as xs:anyAtomicType ,
    $maxValue as xs:anyAtomicType )  as xs:boolean {

   $value >= $minValue and $value <= $maxValue
 } ;

Examples

XQuery ExampleResultsExplanation
functx:between-inclusive(55, 1, 1000)
true
functx:between-inclusive(1, 1, 1000)
true
functx:between-inclusive(1200, 1, 1000)
false
functx:between-inclusive('b', 'b', 'd')
true
functx:between-inclusive(xs:date('2004-10-31'),
                      xs:date('2004-10-15'),
                      xs:date('2004-11-01'))
true
functx:between-inclusive('a', 1, 1000)
Error Strings cannot be compared to integers.

See Also

functx:between-exclusiveWhether a value is between two provided values

History

Published OnLast UpdatedContributor(s)
2006-06-272007-02-26Priscilla Walmsley, Datypic, pwalmsley@datypic.com, http://www.datypic.com
Datypic XQuery Services

Recommended Reading:

XQuery