[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] XSLT 3.0: Catching an error in the declaration/ initialization of a variable that is outside of

Subject: [xsl] XSLT 3.0: Catching an error in the declaration/ initialization of a variable that is outside of <xsl:try>
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jan 2015 04:11:30 -0000

In the 2nd Last Call of the W3C XSLT 3.0 specification, almost at the
end of section 8.3 "Try/Catch",
http://www.w3.org/TR/2014/WD-xslt-30-20141002/#try-catch, there is an
enumerated list of additional rules that apply to the catching of

Of these, Rule 1 says:

"All dynamic errors occurring during the evaluation of the xsl:try
sequence constructor or select expression are caught (provided they
match one of the xsl:catch elements).

 - This includes errors occurring in functions or templates invoked in
the course of this evaluation, unless already caught by a nested

 - It also includes errors caused by calling the error function, or
the xsl:message instruction with terminate="yes", or the xsl:assert

- It does not include errors that occur while evaluating references to
variables whose declaration and initialization is outside the xsl:try"

I wrote a small transformation with the purpose of demonstrating the
last bullet:

<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    <xsl:output method="text"/>

    <xsl:param name="pAmount" select="t"/>

    <xsl:variable name="vAmount" as="xs:decimal" select="$pAmount"/>

    <xsl:template match="/">
            <xsl:sequence select="$vAmount"/>
            <xsl:catch select="-99999999"/>

And I expected that, according to the quoted rule above, the error in
initializing the variable "vAmount" would not be caught, because this
variable's declaration and initialization is outside of the <xsl:try>

However, the result of the transformation, when run with SaxonEE 9.6.02 is:


My question:

Is this a Saxon bug, or is the specification incorrect, or am I not
understanding correctly the rule quoted above.
If the last of these is true, could someone, please, provide an
example, whose running would demonstrate the 3rd bullet of the rule
quoted above?

Dimitre Novatchev

Current Thread