EXSLT - math:max

Version: 1
Status: new
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, for each node in the argument node-set, of the result of converting the string-values of the node to a number using the number function. The numbers are compared as with the > operator. If the node set is empty, 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

Implementations of math:max are available in the following languages:

Examples

element

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/index.html last modified 2001-03-28