Description
The functx:max-string function returns the maximum of the values in $strings . It differs from
the built-in fn:max function only in treats values of all types like strings. The built-in fn:max function, by contrast, treats untyped and numeric values like numbers (and an error is raised if they are not numbers).
Arguments and Return TypeName | Type | Description |
$strings |
xs:anyAtomicType* |
the sequence of values |
return value |
xs:string? |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:max-string
( $strings as xs:anyAtomicType* ) as xs:string? {
max(for $string in $strings return string($string))
} ; |
Exampleslet $in-xml := | <in-xml>
<x>a</x>
<y>c</y>
<z>b</z>
</in-xml> | return |
XQuery Example | Results | Explanation |
---|
functx:max-string( $in-xml/* ) |
c |
Calling the fn:max function instead would have raised an error. |
functx:max-string( (100,25,3) ) |
3 |
See AlsoHistory |
Recommended Reading:
|