Bug #3563
closedPattern schema-element(ITEM)/AUTHOR is not motionless
100%
Description
In a streamable schema-aware stylesheet, use of a pattern such as
match="schema-element(ITEM)/AUTHOR"
passes static analysis as a motionless pattern, but fails at execution time saying:
java.lang.UnsupportedOperationException: net.sf.saxon.trans.XPathException: Navigation using child axis is not supported from a streamed input node
It appears to have been compiled as a GeneralNodePattern rather than as an AncestorQualifiedExpression.
Updated by Michael Kay almost 7 years ago
It seems that the schema-aware optimization has recognized that there can only be one AUTHOR in an ITEM, and has helpfully rewritten the expression as @schema-element(ITEM)/AUTHOR[1]@, In fact it seems to have done this twice, and changed it to @schema-element(ITEM)/AUTHOR[1][1]@. Adding the [1] is useful for XPath expressions, because it stops searching after finding one AUTHOR, and establishes a more accurate type for the expression; but it's counter-productive for XSLT patterns.
Updated by Michael Kay almost 7 years ago
The creation of a FirstItemExpression happens in AxisExpression.checkPlausibility(), line 509.
We can prevent the redundant first(first(X))
by changing this code to special-case the situation where the parent of the AxisExpression is already a FirstItemExpression.
With this change we now get an AncestorQualifiedPattern, but it is still non-streamable because of the [1] predicate.
To suppress the rewrite completely within a pattern, we introduce a switch ExpressionVisitor.optimizeForPatternMatching.
Updated by Michael Kay almost 7 years ago
- Priority changed from Low to Normal
- Applies to branch 9.8, trunk added
- Fix Committed on Branch trunk added
Fixed on the development branch.
Updated by Michael Kay almost 7 years ago
Test case si-apply-templates-007 added (not yet working)
Updated by Michael Kay almost 7 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 9.8 added
Fixed on 9.8 branch and trunk.
New test case is now passing - but on 9.8 it passes when run from the command line, but not from the test driver, because the test driver doesn't handle validation on streamed source documents.
Updated by O'Neil Delpratt almost 7 years ago
- % Done changed from 0 to 100
Bug fix applied in the Saxon 9.8.0.7 maintenance release.
Updated by O'Neil Delpratt almost 7 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.8.0.7 added
Please register to edit this issue