<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="../../style/function.use-cases.xsl"?>
<!-- <!DOCTYPE exslt:function SYSTEM 'function.dtd'> -->
<exslt:function xmlns:exslt="http://exslt.org/documentation" 
                version="1" module="math" status="stable">

<exslt:name>min</exslt:name>

<rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/"
                 ID="math:min">
   <dc:subject>EXSLT</dc:subject>
   <dc:subject>math</dc:subject>
   <dc:subject>min</dc:subject>
   <dc:subject>minimum</dc:subject>
   <dc:rights>public domain</dc:rights>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1">
         <exslt:version>1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com">Jeni Tennison</dc:creator>
         <dc:date>2001-03-28</dc:date>
         <dc:description>Returns the minimum value from a node-set.</dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1.1">
         <exslt:version>1.1</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com">Jeni Tennison</dc:creator>
         <dc:date>2001-04-28</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            <ul>
               <li>Added condition that <code>math:min()</code> must return <code>NaN</code> if any of the values of the nodes in the node set passed as the argument have a numerical value of <code>NaN</code>.</li>
               <li>Changed the definition of the minimum to be the value of the first node in the node list when sorted as with <code>xsl:sort</code> with a data type of <code>number</code> in <code>descending</code> order.</li>
            </ul>
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1.2">
         <exslt:version>1.2</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com">Jeni Tennison</dc:creator>
         <dc:date>2001-05-22</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            <ul>
               <li>Added vendor implementations in Saxon and 4XSLT</li>
               <li>Changed status to stable</li>
            </ul>
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1.3">
         <exslt:version>1.3</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com">Jeni Tennison</dc:creator>
         <dc:date>2001-06-11</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Added vendor implementation in jd.xslt.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1.4">
         <exslt:version>1.4</exslt:version>
         <dc:creator email="mail@jenitennison.com" 
                     url="http://www.jenitennison.com">Jeni Tennison</dc:creator>
         <dc:date>2001-08-23</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">
            Added vendor implementation in libxslt.
         </dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1.5">
         <exslt:version>1.5</exslt:version>
         <dc:creator email="craig.stewart@nottingham.ac.uk" 
                     url="">Craig Stewart</dc:creator>
         <dc:date>2002-08-20</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">Added Xalan-J implementation to the list.</dc:description>
      </rdf:Description>
   </exslt:revision>
   <exslt:revision>
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.1.6">
         <exslt:version>1.6</exslt:version>
         <dc:creator email="craig.stewart@nottingham.ac.uk" 
                     url="">Craig Stewart</dc:creator>
         <dc:date>2002-11-12</dc:date>
         <dc:description xmlns="http://www.w3.org/1999/xhtml">Updated 4XSLT version to 0.12.0a3.</dc:description>
      </rdf:Description>
   </exslt:revision>
</rdf:Description>

<exslt:doc xmlns="">
   <section>
      <para>
         The <function>math:min</function> 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 <ulink URL="http://www.w3.org/TR/xsl#element-sort"><literal>xsl:sort</literal></ulink> with a data type of <literal>number</literal>.  The minimum is the result of converting the string value of the first node in this sorted list to a number using the <ulink URL="http://www.w3.org/TR/xpath#function-number"><function>number</function></ulink> function.
      </para>
      <para>
         If the node set is empty, or if the result of converting the string values of any of the nodes to a number is <literal>NaN</literal>, then <returnvalue>NaN</returnvalue> is returned.      
      </para>
      <para>
         The <literal>math:min</literal> template returns a result tree fragment whose string value is the result of turning the number returned by the function into a string.      
      </para>
   </section>
</exslt:doc>

<exslt:definition>
   <exslt:return type="number" />
   <exslt:arg name="nodes" type="node-set" default="/.." />
</exslt:definition>

<exslt:implementations>
   <exslt:vendor-implementation
           version="1"
           vendor="4XSLT, from 4Suite."
           vendor-url="http://4Suite.org"
           vendor-version="0.12.0a3" />
   <exslt:vendor-implementation
           version="1"
           vendor="SAXON from Michael Kay"
           vendor-url="http://users.iclway.co.uk/mhkay/saxon/index.html"
           vendor-version="6.3" />
   <exslt:vendor-implementation
           version="1"
           vendor="jd.xslt from Johannes D&#246;bler"
           vendor-url="http://www.aztecrider.com/xslt/"
           vendor-version="1.0.9" />
   <exslt:vendor-implementation
           version="1"
           vendor="libxslt from Daniel Veillard; implementation by Thomas Broyer"
           vendor-url="http://xmlsoft.org/XSLT/"
           vendor-version="1.0.19" />
   <exslt:vendor-implementation
           version="1"
           vendor="Xalan-J from Apache"
           vendor-url="http://xml.apache.org/xalan-j"
           vendor-version="2.4.D1" />
   <exslt:implementation src="math.min.function.xsl" language="exslt:exslt" 
                         version="1" />
   <exslt:implementation src="math.min.template.xsl" language="exslt:xslt" 
                         version="1" />
   <exslt:implementation src="math.min.js" language="exslt:javascript" 
                         version="1" />
</exslt:implementations>

<exslt:use-cases>
   <exslt:use-case type="example" data="math.min.data.1.xml"
                   xslt="math.min.1.xsl" result="math.min.result.1.xml" />
   <exslt:use-case type="example" template="yes" data="math.min.data.1.xml"
                   xslt="math.min.2.xsl" result="math.min.result.1.xml" />
   <exslt:use-case type="boundary" data="math.min.data.2.xml"
                   xslt="math.min.1.xsl" result="math.min.result.2.xml" />
   <exslt:use-case type="boundary" template="yes" data="math.min.data.2.xml"
                   xslt="math.min.2.xsl" result="math.min.result.2.xml" />
   <exslt:use-case type="error" data="math.min.data.1.xml"
                   xslt="math.min.3.xsl">
      <exslt:doc xmlns="">
         <para>
            This use case shows an error when the function is passed a 
            number as the value of the first argument.
         </para>
      </exslt:doc>
   </exslt:use-case>
   <exslt:use-case type="error" template="yes" data="math.min.data.1.xml"
                   xslt="math.min.4.xsl">
      <exslt:doc>
         <para>
            This use case shows an error when the function is passed a 
            number as the value of the <parameter>nodes</parameter> 
            parameter.
         </para>
      </exslt:doc>
   </exslt:use-case>
   <exslt:use-case type="example" data="math.min.data.5.xml" 
                   xslt="math.min.5.xsl" 
                   result="math.min.result.5.xml">
      <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                       xmlns:dc="http://purl.org/dc/elements/1.1/"
                       ID="math:min.use-case.7">
         <dc:subject>EXSLT</dc:subject>
         <dc:subject>maths</dc:subject>
         <dc:subject>min</dc:subject>
         <dc:subject>use case</dc:subject>
         <exslt:revision>
            <rdf:Description xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                             xmlns:dc="http://purl.org/dc/elements/1.1/"
                             ID="math:min.use-case.7.1">
               <exslt:version>1</exslt:version>
               <dc:creator email="mhkay@iclway.co.uk">Mike Kay</dc:creator>
               <dc:date>2001-04-28</dc:date>
               <dc:description>Tests functionality of math:max() and math:min().</dc:description>
            </rdf:Description>
         </exslt:revision>
      </rdf:Description>
   </exslt:use-case>
</exslt:use-cases>

</exslt:function>

