Actions
Bug #4146
closedError not caught by try catch, because an expression is loop-lifted outside the xsl:try
Start date:
2019-02-23
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.9, trunk
Fix Committed on Branch:
9.9, trunk
Fixed in Maintenance Release:
Platforms:
Description
Reported by Mukul Gandhi on xsl:list. Given this stylesheet
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:err="http://www.w3.org/2005/xqt-errors"
exclude-result-prefixes="err"
version="3.0">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:try>
<xsl:value-of select="for $x in (1 to count(test/hello)) return (1 div 0)"/>
<xsl:catch errors="*">
<error code="{$err:code}" description="{$err:description}" location="line:{$err:line-number}, col:{$err:column-number}"/>
</xsl:catch>
</xsl:try>
</xsl:template>
</xsl:stylesheet>
Saxon isn't catching the division-by-zero error. The error is reported dynamically, rather than statically, but it occurs outside the scope of the try/catch, apparently as a result of a loop-lifting optimisation.
Please register to edit this issue
Actions