https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2022-10-26T09:25:07ZSaxonica Developer CommunitySaxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=220132022-10-26T09:25:07ZMichael Kaymike@saxonica.com
<ul></ul><p>Reordering of predicates is allowed by the XPath specification.</p>
<p>Whether it should be allowed is another matter - see <a href="https://github.com/qt4cg/qtspecs/issues/71" class="external">https://github.com/qt4cg/qtspecs/issues/71</a></p>
<p>But at the moment, the spec allows it and Saxon takes advantage of the fact for optimisation. The only way to guarantee order of evaluation of conditionals is to use an if-then-else construct.</p> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=220142022-10-26T10:37:59ZMichael Kaymike@saxonica.com
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li><li><strong>Assignee</strong> set to <i>Michael Kay</i></li><li><strong>Applies to branch</strong> <i>11, trunk</i> added</li><li><strong>Fix Committed on Branch</strong> <i>11, trunk</i> added</li><li><strong>Platforms</strong> <i>.NET</i> added</li></ul><p>As a quick fix, I'm adding an optimization flag so <code>-opt:-p</code> will suppress this optimization. This will be in 12.x and the next maintenance release of 11.x.</p>
<p>Leaving the issue open, because I think a better (but more difficult) fix would be to do the optimization in such a way that reordering of predicates does not cause spurious errors.</p> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=220152022-10-26T10:49:53ZAndy Yarandyyar66@gmail.com
<ul></ul><p>Thank you for the explanation.</p>
<p>Changing the behavior for XSLT/XPath 4.0 would be great.</p> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=220162022-10-26T12:12:45ZMichael Kaymike@saxonica.com
<ul><li><strong>Assignee</strong> deleted (<del><i>Michael Kay</i></del>)</li><li><strong>Applies to branch</strong> deleted (<del><i>11, trunk</i></del>)</li><li><strong>Fix Committed on Branch</strong> deleted (<del><i>11, trunk</i></del>)</li><li><strong>Platforms</strong> deleted (<del><i>.NET</i></del>)</li></ul> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=220182022-10-26T13:31:08ZMichael Kaymike@saxonica.com
<ul><li><strong>Category</strong> set to <i>Internals</i></li><li><strong>Assignee</strong> set to <i>Michael Kay</i></li><li><strong>Applies to branch</strong> <i>11, trunk</i> added</li><li><strong>Fix Committed on Branch</strong> <i>11, trunk</i> added</li><li><strong>Platforms</strong> <i>.NET</i> added</li></ul> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=221532022-11-26T16:14:10ZMichael Kaymike@saxonica.com
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li><li><strong>Priority</strong> changed from <i>Low</i> to <i>Normal</i></li></ul><p>On the 11.x branch I added a partial fix that allows the optimization to be suppressed.</p>
<p>For 12.x, predicates can stll be reordered, but this should not generate any spurious errors. A composite filter expression <code>A[P1][P2][P3]</code> is now rewritten as <code>A[P1 and P2 and P3]</code>, and an "and" expression is evaluated so that if the first operand throws an error, we catch it and save it; if any operand is false, we return false and ignore the error, which means that re-ordering the operands no longer generates spurious errors.</p>
<p>So in the example given, <code>test/*[contains(name(), 'LieferscheinNummer')][. != ''][. != 0]</code> we might still evaluate the predicates in reverse order, but we will only throw an error if <code>contains(name(), 'LieferscheinNummer')]</code> is true.</p> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=224312023-01-13T18:09:01ZCommunity Adminsupport@saxonica.com
<ul><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Fixed in Maintenance Release</strong> <i>12.0</i> added</li></ul><p>Bug issue fix applied in the Saxon 12.0 Major Release.
Leaving this bug marked as Resolved until fix applied</p> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=228672023-02-08T15:46:52ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Fixed in Maintenance Release</strong> <i>11.5</i> added</li></ul><p>Bug applied in the Saxon 11.5 Maintenance release.</p> Saxon - Bug #5721: Saxon EE 10.8J optimizations break order of XPath selectorshttps://saxonica.plan.io/issues/5721?journal_id=228982023-02-08T15:49:22ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li></ul>