Sophie

Sophie

distrib > Mageia > 7 > armv7hl > by-pkgid > b3bdfe6d859a3d6920ff2c44b38e9a6f > files > 326

saxon-manual-9.4.0.9-2.mga7.noarch.rpm

<?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="leading"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: saxon:leading()</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: saxon:leading()"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>saxon:leading()</h1>
      <p><b>saxon:leading($input as item()*) ==&gt; item()*</b></p>
      <p><b>saxon:leading($input as item()*, $test as function()) ==&gt; item()*</b></p>
      <p>This function returns a sequence containing all those nodes from <code>$input</code> up to and excluding the
first one (in order of the input sequence) for which $test has an effective boolean value of false.
A function may be obtained in XQuery 1.1 using any of the new mechanisms for constructing functions; in other
environments, it may be obtained by calling <a class="bodylink" href="../../extensions/functions/function.xml">saxon:function</a>.</p>
      <p>The <code>$test</code> argument defaults to the function <code>fn:data#1</code>, that is, it atomizes the item.</p>
      <p>The <code>$test</code> function is evaluated for item in $input in turn, with that item supplied as the argument
    to the function. The result consists of that leading sequence of items for which the effective boolean value of 
  the function is true.</p>
      <p>XQuery 1.1 example:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>saxon:leading(following-sibling::*, function($x){$x/self::para})</code>
         </pre>
      </div>
      <p>XSLT 2.0 example:</p>
      <div class="codeblock"
           style="border: solid thin; background-color: #B1CCC7; padding: 2px">
         <pre>
            <code>saxon:leading(following-sibling::*, saxon:function('f:is-para', 1)</code>
         </pre>
      </div>
      <p>where <code>f:is-para</code> is a user-defined function that tests whether the supplied item is a 
    <code>&lt;para&gt;</code> element </p>
      <p>This will return 
  the <code>&lt;para&gt;</code> elements following the current node, stopping at the first element that is not a
  <code>&lt;para&gt;</code>.</p>
      <p><i>Note: this function is quite different from the EXSLT leading() function, though both fulfil
a similar purpose.</i></p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="linenumber.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>