# EXSLT - math:max

Implementer Page: math.max.html 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. ## Implementations The following XSLT processors support `math:max`: 4XSLT, from 4Suite. (version 0.12.0a3) SAXON from Michael Kay (version 6.3) jd.xslt from Johannes Döbler (version 1.0.9) libxslt from Daniel Veillard; implementation by Thomas Broyer (version 1.0.19) Xalan-J from Apache (version 2.4.D1) Implementations of `math:max` are available in the following languages: EXSLT Function (by Jeni Tennison) XSLT Template (by Jeni Tennison) ## Examples ### Function The following example shows how to use the `math:max` function: #### Source
    <values>
       <value>7</value>
       <value>11</value>
       <value>8</value>
       <value>4</value>
    </values>
#### Stylesheet
    <xsl:template match="values">
       <result>
          <xsl:text>Maximum: </xsl:text>
          <xsl:value-of select="math:max(value)" />
       </result>
    </xsl:template>
#### Result
    <result>Maximum: 11</result>
### Template The following example shows how to use the `math:max` template: #### Source
    <values>
       <value>7</value>
       <value>11</value>
       <value>8</value>
       <value>4</value>
    </values>
#### Stylesheet
    <xsl:template match="values">
       <result>
          <xsl:text>Maximum: </xsl:text>
          <xsl:call-template name="math:max">
             <xsl:with-param name="nodes"
                             select="value" />
          </xsl:call-template>
       </result>
    </xsl:template>
#### Result
    <result>Maximum: 11</result>

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