EXSLT - math:min

Version: 1
Status: new
Function Package: math.min.zip

Function Syntax

number math:min(node-set)

Template Syntax

<xsl:call-template name="math:min">
   <xsl:with-param name="nodes" select="node-set" />
</xsl:call-template>

The math:min function returns the minimum, 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:min 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:min are available in the following languages:

Examples

element

The following example shows how to use the math:min function:

Source

<values>
   <value>7</value>
   <value>11</value>
   <value>8</value>
   <value>4</value>
</values>

Stylesheet

<xsl:template match="values">
   <result>
      <xsl:text>Minimum: </xsl:text>
      <xsl:value-of select="math:min(value)" />
   </result>
</xsl:template>

Result

<result>Minimum: 4</result>

Template

The following example shows how to use the math:min template:

Source

<values>
   <value>7</value>
   <value>11</value>
   <value>8</value>
   <value>4</value>
</values>

Stylesheet

<xsl:template match="values">
   <result>
      <xsl:text>Minimum: </xsl:text>
      <xsl:call-template name="math:min">
         <xsl:with-param name="nodes"
                         select="value" />
      </xsl:call-template>
   </result>
</xsl:template>

Result

<result>Minimum: 4</result>

http://www.exslt.org/index.html last modified 2001-03-28