<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="extensions" page="functions" subpage="lowest"/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: saxon:lowest()</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: saxon:lowest()"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>saxon:lowest()</h1>
      <p><b>saxon:lowest($input as item()*) =&gt; item()*</b></p>
      <p><b>saxon:lowest($input as item()*, $key as function()) =&gt; item()?</b></p>
      <p>This function returns the item or items from the input sequence that have the lowest value for the function <code>$key</code>.
    If the second argument is omitted, it defaults to the function <code>fn:data#1</code>, that is, it atomizes the item from the
    input sequence.</p>
      <p>In XQuery 1.1, the function may be obtained in a variety of ways. In other environments, it may be obtained
    by calling the <a class="bodylink" href="../../extensions/functions/function.xml">saxon:function()</a> extension
    function.</p>
      <p>The <code>$key</code> function is evaluated for each item in <code>$input</code> in turn, with that item supplied
    as the parameter to the function. Any NaN values are ignored. If the input sequence is empty, the result
    is an empty sequence. If several items have the lowest value, the result sequence contains them all.</p>
      <p>Example: saxon:lowest(sale, function($x){$x/@price * $x/@qty'}) will evaluate price times
    quantity for each child <code>&lt;sale&gt;</code> element, and return the element or elements for which this has the lowest
    value.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="namespace-node.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>