<?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="linenumber"/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: saxon:line-number(node)</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: saxon:line-number(node)"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>saxon:line-number(node)</h1>
      <p><b>saxon:line-number() ==&gt; xs:integer</b></p>
      <p><b>saxon:line-number($node as node()) ==&gt; xs:integer</b></p>
      <p>This function returns the line number of a selected node within the XML document (or external entity)
that contains it. If the argument is supplied, it must be a node; if the argument is omitted, the context item is used,
in which case the context item must be a node. If line numbers are not maintained for the current
document, the function returns -1.</p>
      <p>To ensure that line numbers are maintained, use the -l (letter ell)
option on the command line.</p>
      <p>Note that the value returned is dependent on information supplied by the XML parser. For an element node, SAX parsers generally report
the line and column position of the "&gt;" character at the end of the start tag. StAX parsers by contrast report the position of the "&lt;"
character at the start of the start tag. SAX parsers report line and column numbers only for element nodes, so for
any other kind of node, the returned value will be -1.</p>
      <p>From release 9.0, the -l option also causes line numbers to be copied from a source document to a result 
document when the <code>xsl:copy-of</code> instruction is applied to a document or element node. For elements
created using other instructions, the line number will reflect the position of the instruction in the stylesheet
or query that caused the element to be created.</p>
      <p>See also <a class="bodylink" href="../../extensions/functions/columnnumber.xml">saxon:column-number()</a>.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="lowest.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>