<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="xsl-elements" page="evaluate" subpage=""/>
      <!--
           Generated at 2010-10-29T18:20:48.427+01:00--><title>Saxonica: XSLT and XQuery Processing: xsl:evaluate</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title" content="Saxonica: XSLT and XQuery Processing: xsl:evaluate"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>xsl:evaluate</h1>
      <p>The <code>xsl:evaluate</code> instruction is new in XSLT 2.1. It allows dynamic evaluation
of XPath expressions constructed as a string, in the same way as the <code>saxon:evaluate()</code>
extension function that has been available in Saxon for many years.</p>
      <p>The functionality is available as an XSLT instruction, rather than a function, to allow more
flexibility in the syntax, in particular the ability to define parameters using <code>xsl:with-param</code>
child elements.</p>
      <p>The instruction is fully implemented in Saxon 9.3 with the following exceptions:</p>
      <ul>
         <li content="para">
            <p>Functions available only in XSLT, such as key(), cannot be used in the target XPath expression.</p>
         </li>
      </ul>
      <p>The instruction may take an <code>xsl:fallback</code> to define fallback behaviour when using an
XSLT 2.0 processor.</p>
      <p>Attributes:</p>
      <ul>
         <li content="para">
            <p>xpath: an expression, which is evaluated to return the target expression as a string.</p>
         </li>
         <li content="para">
            <p>base-uri: a string (as an AVT), gives the base URI for the target expression. Defaults to the base
  URI of the stylesheet instruction.</p>
         </li>
         <li content="para">
            <p>namespace-context: an expression returning a node; the in-scope namespaces of this node define
  the namespace context for the XPath expression. Defaults to the namespace context of the <code>xsl:evaluate</code>
  instruction in the stylesheet</p>
         </li>
         <li content="para">
            <p>as: a SequenceType: defines the required type of the result of the XPath expression. Defaults to <code>item()*</code>
         </p>
         </li>
         <li content="para">
            <p>schema-aware: "yes" or "no", as an AVT: if "yes", the XPath expression has access to the schema components imported
  into the stylesheet.</p>
         </li>
      </ul>
      <p>Children:</p>
      <ul>
         <li content="para">
            <p>
            <code>xsl:with-param</code>: defines variables that the target expression can use.</p>
         </li>
         <li content="para">
            <p>
            <code>xsl:fallback</code>: defines fallback behaviour when using an
XSLT 2.0 (or 1.0) processor.</p>
         </li>
      </ul>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="fallback.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>