home contribute faq download

FunctX XSLT Functions

functx:max-string

The maximum of a sequence of values, treating them like strings

Google
Webdatypic.com

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 Type

NameTypeDescription
$strings xs:anyAtomicType* the sequence of values
return value xs:string?

XSLT Function Declaration

See XQuery definition.
<xsl:function name="functx:max-string" as="xs:string?"
              xmlns:functx="http://www.functx.com">
  <xsl:param name="strings" as="xs:anyAtomicType*"/>

  <xsl:sequence select="
   max(for $string in $strings return string($string))
 "/>

</xsl:function>

Examples

<xsl:variable name="in-xml" as="item()*">
<in-xml>
  <x>a</x>
  <y>c</y>
  <z>b</z>
</in-xml>
</xsl:variable>
XPath ExampleResultsExplanation
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 Also

fn:maxThe maximum of a sequence of values
functx:max-determine-typeThe maximum value in a sequence, figuring out its type (numeric or string)
functx:min-stringThe minimum of a sequence of values, treating them like strings

History

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

Recommended Reading:

XQuery