<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet href="../../make-menu.xsl" type="text/xsl"?><html>
   <head>
      <this-is section="changes" page="s90" subpage="expressiontree90"/>
      <!--
           Generated at 2011-12-09T20:47:22.916Z--><title>Saxonica: XSLT and XQuery Processing: Expression tree changes</title>
      <meta name="coverage" content="Worldwide"/>
      <meta name="copyright" content="Copyright Saxonica Ltd"/>
      <meta name="title"
            content="Saxonica: XSLT and XQuery Processing: Expression tree changes"/>
      <meta name="robots" content="noindex,nofollow"/>
      <link rel="stylesheet" href="../../saxondocs.css" type="text/css"/>
   </head>
   <body class="main">
      <h1>Expression tree changes</h1>
      <p>There have been changes to the internal structure of the expression tree generated by the XSLT, XQuery,
and XPath processors, and to the way it is navigated. Most notably, the tree no longer contains any parent pointers
linking a subexpression to its containing expression. These have been removed primarily because the code for maintaining
the parent pointers was complex and prone to bugs. To compensate for the absence of these pointers, the various traversals
of the expression tree (simplify, typeCheck, and optimize), now make use of an <code>ExpressionVisitor</code> object that
maintains references to all the containing expressions in the form of a stack.</p>
      <p>Expressions now have a link to a <code>Container</code> object that provides access to the outside world, for example to
the <code>Configuration</code> and <code>NamePool</code>. However, this is used only for diagnostics, because it is not
guaranteed to be available in 100% of cases, especially while the tree is under construction.</p>
      <p>There is now an internal diagnostic switch allowing tracing of the decisions made by the optimizer. Not all rewrites
are yet traced in this way.</p>
      <p>The class <code>IfExpression</code> no longer exists; all conditional expressions including <code>xsl:if</code>,
<code>xsl:choose</code>, XPath <code>if-then-else</code>, and XQuery <code>typeswitch</code> are now compiled
to a (potentially multi-way) <code>Choose</code> expression.</p>
      <table width="100%">
         <tr>
            <td>
               <p align="right"/>
            </td>
         </tr>
      </table>
   </body>
</html>