EXSLT - math:highest

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

Function Syntax

node-set math:highest(node-set)

Template Syntax

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

The math:highest function returns the nodes in the node set whose value is the maximum value for the node set. The maximum value for the node set is the same as the value as calculated by math:max. A node has this maximum value if the result of converting its string value to a number as if by the number function is equal to the maximum 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:max 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:highest will return an empty node set.

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

Implementations

The following XSLT processors support math:highest:

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

Examples

Function

The following example shows how to use the math:highest 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>Highest: </xsl:text>
      <xsl:value-of select="math:highest(value)/@id" />
   </result>
</xsl:template>

Result

<result>Highest: two</result>

Template

The following example shows how to use the math:highest 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>Highest: </xsl:text>
      <xsl:call-template name="math:highest">
         <xsl:with-param name="nodes"
                         select="value" />
      </xsl:call-template>
   </result>
</xsl:template>

Result

<result>Highest: two</result>

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