<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="sql-extension" page="warning-1" subpage=""/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: A Warning about Side-Effects</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: A Warning about Side-Effects"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>A Warning about Side-Effects</h1>
      <p>XSLT does not guarantee the order of execution of instructions. In principle, the 
<code>sql:close</code> instruction could be evaluated before the <code>sql:query</code>
instruction, which would obviously be disastrous.</p>
      <p>In practice, Saxon's order of execution for XSLT instructions is reasonably predictable
 unless you use variables, or unless you invoke stylesheet functions from within an XPath
 expression. Using the SQL extension instructions within templates that are directly invoked
 is thus fairly safe, but it is not a good idea to invoke them as a side-effect of computing
 a variable or invoking a function. The exceptions are <code>sql:connect</code> and
 <code>sql:query</code>: if you use these instructions to evaluate the content of a variable,
 then of course they will be executed before any instruction that uses the value of the
 variable.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"><a class="nav" href="warning-2.xml">Next</a></p>
            </td>
         </tr>
      </table>
   </body>
</html>