Compares the value of $string-var1 to $string-var2.
xf:compare(xs:string? $string-var1, xs:string? $string-var2) —> xs:integer?
Returns -1, 0, or 1, depending on whether the value of $string-var1 is less than (-1), equal to (0), or greater than (1) the value of $string-var2.
Invoking compare('abc', 'abcde') returns an integer -1, because $string-var1 is less than $string-var2, as shown by the following example query:
<result>{xf:compare('abc', 'abcde')}</result>
The preceding query, generates the following XML result:
<result>-1</result>
Invoking compare('abc', 'abc') returns an integer 0, because the two string are equal, as shown by the following example query:
<result>{xf:compare('abc', 'abc')}</result>
The preceding query, generates the following XML result:
<result>0</result>
Invoking compare('abcde', 'abc') returns an integer 1, because $string-var1 is greater than $string-var2, as shown by the following example query:
<result>{xf:compare('abcde', 'abc')}</result>
The preceding query, generates the following XML result:
<result>1</result>
W3C compare function description.