Project

Profile

Help

Bug #4146

closed

Error not caught by try catch, because an expression is loop-lifted outside the xsl:try

Added by Michael Kay about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
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

Also available in: Atom PDF