<?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="item-at"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: saxon:item-at()</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: saxon:item-at()"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>saxon:item-at()</h1>
      <p><b>saxon:item-at($seq as item()*, $index as numeric?) ==&gt; item()?</b></p>
      <p>This function returns the item at a given position in a sequence. The index counts from one. If the index
is an empty sequence, or less than one, or not a whole number, or greater than the length of the sequence,
the result is an empty sequence.</p>
      <p><i>This function is provided largely because it is used internally by the Saxon optimizer.
For user applications, it is better to use <code>$seq[$index]</code> which will return the same result
provided there are no context-dependencies in <code>$index</code>, or 
<code>subsequence($seq, $index, 1)</code> which will return the same
result in all cases where <code>$index</code> evaluates to an integer.</i></p>
      <p>Example:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>saxon:item-at(10 to 20, 8)</code>
         </pre>
      </div>
      <p>will return 17.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="last-modified.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>