EXSLT - math:lowest

Implementer Page: math.lowest.html
Function Package: math.lowest.zip

Function Syntax

node-set math:lowest(node-set)

Template Syntax

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

The math:lowest function returns the nodes in the node set whose value is the minimum value for the node set. The minimum value for the node set is the same as the value as calculated by math:min. A node has this minimum value if the result of converting its string value to a number as if by the number function is equal to the minimum value, where the equality comparison is defined as a numerical comparison using the = operator.

If any of the nodes in the node set has a non-numeric value, the math:min function will return NaN. The definition numeric comparisons entails that NaN != NaN. Therefore if any of the nodes in the node set has a non-numeric value, math:lowest will return an empty node set.

The math:lowest template returns a result tree fragment consisting of copies of the nodes as returned by the function.

Implementations

The following XSLT processors support math:lowest:

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

Examples

Function

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

Source

<values>
   <value id="one">7</value>
   <value id="two">11</value>
   <value id="three">8</value>
   <value id="four">4</value>
</values>

Stylesheet

<xsl:template match="values">
   <result>
      <xsl:text>Lowest: </xsl:text>
      <xsl:value-of select="math:lowest(value)/@id" />
   </result>
</xsl:template>

Result

<result>Lowest: four</result>

Template

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

Source

<values>
   <value id="one">7</value>
   <value id="two">11</value>
   <value id="three">8</value>
   <value id="four">4</value>
</values>

Stylesheet

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

Result

<result>Lowest: four</result>

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