# EXSLT - math:max - Implementer Page

Version: 1 Status: stable User Page: index.html XML Definition: math.max.xml Function Package: math.max.zip #### Function Syntax
    number math:max(node-set)
#### Template Syntax
    <xsl:call-template name="math:max">
       <xsl:with-param name="nodes" select="node-set" />
    </xsl:call-template>
The `math:max` function returns the maximum value of the nodes passed as the argument. The maximum value is defined as follows. The node set passed as an argument is sorted in descending order as it would be by `xsl:sort` with a data type of `number`. The maximum is the result of converting the string value of the first node in this sorted list to a number using the `number` function. If the node set is empty, or if the result of converting the string values of any of the nodes to a number is `NaN`, then `NaN` is returned. The `math:max` template returns a result tree fragment whose string value is the result of turning the number returned by the function into a string. An implementation of this extension function in the EXSLT math namespace must conform to the behaviour described in this document. ## Implementations Built-in support for `math:max` is available in the following XSLT processors:
Processor | Processor Version | Implemented Version
--- | --- | ---
4XSLT, from 4Suite. | 0.12.0a3 | 1
SAXON from Michael Kay | 6.3 | 1
jd.xslt from Johannes Döbler | 1.0.9 | 1
libxslt from Daniel Veillard; implementation by Thomas Broyer | 1.0.19 | 1
Xalan-J from Apache | 2.4.D1 | 1
The following implementations of `math:max` are available:
Language | Implemented Version | Creator | Date | Download
--- | --- | --- | --- | ---
EXSLT Function | 1 | Jeni Tennison | 2001-03-28 | math.max.function.xsl
XSLT Template | 1 | Jeni Tennison | 2001-03-28 | math.max.template.xsl
## Use Cases Use Case Package: math.max.use-cases.zip The following use cases illustrate the functionality of `math:max`.
Details | Calling Stylesheet | XML Data | Expected Result | Category | Template
--- | --- | --- | --- | --- | ---
1 | math.max.1.xsl | math.max.data.1.xml | math.max.result.1.xml | example | N
2 | math.max.2.xsl | math.max.data.1.xml | math.max.result.1.xml | example | Y
3 | math.max.1.xsl | math.max.data.2.xml | math.max.result.2.xml | boundary | N
4 | math.max.2.xsl | math.max.data.2.xml | math.max.result.2.xml | boundary | Y
5 | math.max.3.xsl | math.max.data.1.xml | - | error | N
6 | math.max.4.xsl | math.max.data.1.xml | - | error | Y
7 | math.max.5.xsl | math.max.data.5.xml | math.max.result.5.xml | example | N
## Change History Submitted: 2001-03-28 Creator: Jeni Tennison(http://www.jenitennison.com) Returns the maximum value from a node-set.
Version | Modified | By | Details
--- | --- | --- | ---
1.1 | 2001-04-28 | Jeni Tennison | Added condition that `math:max()` must return `NaN` if any of the values of the nodes in the node set passed as the argument have a numerical value of `NaN`. Changed the definition of the maximum to be the value of the first node in the node list when sorted as with `xsl:sort` with a data type of `number` in `descending` order.
1.2 | 2001-05-22 | Jeni Tennison | Added vendor implementations in Saxon and 4XSLT Changed status to stable
1.3 | 2001-06-11 | Jeni Tennison | Added vendor implementation in jd.xslt.
1.4 | 2001-08-23 | Jeni Tennison | Added vendor implementation in libxslt.
1.5 | 2002-08-20 | Craig Stewart | Added Xalan-J implementation to the list.
1.6 | 2002-11-12 | Craig Stewart | Updated 4XSLT version to 0.12.0a3.
## Copyright This material is in the public domain.

http://www.exslt.org/math/functions/max/math.max.html last modified 2002-11-12