EXSLT - math:min - Version 1

Version: 1
Status: stable
User Page: index.html
XML Definition: math.min.xml
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 value of the nodes passed as the argument. The minimum value is defined as follows. The node set passed as an argument is sorted in ascending order as it would be by xsl:sort with a data type of number. The minimum 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: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

Built-in support for math:min is available in the following XSLT processors:

ProcessorProcessor VersionImplemented Version
4XSLT, from 4Suite.0.12.0a31
SAXON from Michael Kay6.31
jd.xslt from Johannes Döbler1.0.91
libxslt from Daniel Veillard; implementation by Thomas Broyer1.0.191
Xalan-J from Apache2.4.D11

The following implementations of math:min are available:

LanguageImplemented VersionCreatorDateDownload
EXSLT Function1Jeni Tennison2001-03-28math.min.function.xsl
XSLT Template1Jeni Tennison2001-03-28math.min.template.xsl
Javascript1Jeni Tennison2001-03-28math.min.js

Use Cases

Use Case Package: math.min.use-cases.zip

The following use cases illustrate the functionality of math:min.

DetailsCalling StylesheetXML DataExpected ResultCategoryTemplate
1math.min.1.xslmath.min.data.1.xmlmath.min.result.1.xmlexampleN
2math.min.2.xslmath.min.data.1.xmlmath.min.result.1.xmlexampleY
3math.min.1.xslmath.min.data.2.xmlmath.min.result.2.xmlboundaryN
4math.min.2.xslmath.min.data.2.xmlmath.min.result.2.xmlboundaryY
5math.min.3.xslmath.min.data.1.xml-errorN
6math.min.4.xslmath.min.data.1.xml-errorY
7math.min.5.xslmath.min.data.5.xmlmath.min.result.5.xmlexampleN

Change History

Submitted: 2001-03-28
Creator: Jeni Tennison(http://www.jenitennison.com)

Returns the minimum value from a node-set.

VersionModifiedByDetails
1.12001-04-28Jeni Tennison
  • Added condition that math:min() must return NaN if any of the values of the nodes in the node set passed as the argument have a numerical value of NaN.
  • Changed the definition of the minimum to be the value of the first node in the node list when sorted as with xsl:sort with a data type of number in descending order.
1.22001-05-22Jeni Tennison
  • Added vendor implementations in Saxon and 4XSLT
  • Changed status to stable
1.32001-06-11Jeni Tennison

Added vendor implementation in jd.xslt.

1.42001-08-23Jeni Tennison

Added vendor implementation in libxslt.

1.52002-08-20Craig Stewart

Added Xalan-J implementation to the list.

1.62002-11-12Craig Stewart

Updated 4XSLT version to 0.12.0a3.

Copyright

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