Bug #3316
closed"Bad parent pointer" after simplifying nested blocks.
100%
Description
Given the following template rule:
<xsl:template name="t" as="node()*">
<xsl:param name="e" as="element()?"/>
<xsl:sequence select="$e, $e"/>
</xsl:template>
we get several "Bad parent pointer found" warning messages during compilation.
Originally raised here: https://saxonica.plan.io/boards/3/topics/6838?r=6841
Updated by Michael Kay over 7 years ago
Internally, Saxon represents both a sequence constructor and a comma-expression as a "Block" expression, so the initial structure of the expression tree here is
Block(Param, Block($e, $e))
The simplify() operation on a Block flattens any nested blocks, so this is reduced to:
Block(Param $e, $e)
It seems that this flattening operation is not resetting parent pointers on the 3 child expressions to the new flattened Block.
Updated by Michael Kay over 7 years ago
- Description updated (diff)
- Category set to Internals
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 9.8 added
Updated by Michael Kay over 7 years ago
XSLTemplate.refineTemplateBody() is doing
Expression result = body.simplify();
which modifies the subexpressions of body to point to "result" as the new parent; this means that the tree underneath "body" is no longer valid.
But then (on this particular path) it is subsequently doing
result = typeCheck(body);
which uses the original tree rather than the simplified tree as input.
Updated by Michael Kay over 7 years ago
- Status changed from New to Resolved
- Fix Committed on Branch 9.8 added
Fixed on the 9.8 branch
Updated by O'Neil Delpratt over 7 years ago
- % Done changed from 0 to 100
- Fixed in Maintenance Release 9.8.0.3 added
Bug fix applied in the Saxon 9.8.0.3 maintenance release.
Updated by O'Neil Delpratt over 7 years ago
- Status changed from Resolved to Closed
Please register to edit this issue