Bug #4346
closedStreamed optimization of xsl:copy doesn't converge
0%
Description
Given a streamed xsl:copy instruction where the node kind that it applies to can't be determined statically, the expression is split into two:
if (kind = (attribute, namespace, text, comment, pi))
then copy-of(.)
else copy(....)
But typically the result goes through the optimizer more than once, and on the second pass through it becomes:
if (kind = (attribute, namespace, text, comment, pi))
then copy-of(.)
else if (kind = (attribute, namespace, text, comment, pi))
then copy-of(.)
else copy(....)
with the number of branches in the conditional increasing on each pass through the optimizer.
Seen in test case si-apply-templates-010.
Updated by Michael Kay over 4 years ago
On the development branch, did a rather ad-hoc fix to Copy.optimize()
where it tries to detect whether the optimization has already been done, and refrains from doing it again.
Updated by Michael Kay over 4 years ago
- Category set to Streaming
- Status changed from New to Resolved
- Applies to branch 9.9, trunk added
- Fix Committed on Branch 9.9, trunk added
It's difficult to come up with a better fix. Ideally if the first branch of a conditional says "test=". instance of X" then we know in subsequent branches that the context item isn't an instance of X; but doing that would be a significant step forward in our current type inferencing logic.
So I'm resolving it with this rather simplistic fix.
Updated by O'Neil Delpratt over 4 years ago
- Status changed from Resolved to Closed
- Fixed in Maintenance Release 9.9.1.6 added
Patch committed to the Saxon 9.9.1.6 maintenance release.
Please register to edit this issue