[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: XSLT 3.0: Catching an error in the declaration/ i

Subject: Re: XSLT 3.0: Catching an error in the declaration/ initialization of a variable that is outside of <xsl:try>
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jan 2015 09:27:15 -0000
Re:  XSLT 3.0: Catching an error in the declaration/  i
This looks like a bug in the Saxon implementation.

Michael Kay
Saxonica
mike@xxxxxxxxxxxx
+44 (0) 118 946 5893




On 22 Jan 2015, at 04:11, Dimitre Novatchev dnovatchev@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> 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
> errors.
>
> 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
> xsl:try.
>
> - It also includes errors caused by calling the error function, or
> the xsl:message instruction with terminate="yes", or the xsl:assert
> instruction.
>
> - 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"
>    xmlns:xs="http://www.w3.org/2001/XMLSchema">
>    <xsl:output method="text"/>
>
>    <xsl:param name="pAmount" select="t"/>
>
>    <xsl:variable name="vAmount" as="xs:decimal" select="$pAmount"/>
>
>    <xsl:template match="/">
>        <xsl:try>
>            <xsl:sequence select="$vAmount"/>
>            <xsl:catch select="-99999999"/>
>        </xsl:try>
>    </xsl:template>
> </xsl:stylesheet>
>
>
> 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>
> instruction.
>
> However, the result of the transformation, when run with SaxonEE 9.6.02 is:
>
> -99999999
>
>
> 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?
>
>
> --
> Cheers,
> Dimitre Novatchev

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.