"XPST0008 Variable err:code has not been declared" in xsl:catch
Lambert Giese <[email protected]> Fri, 5 Mar 2021 12:06:01 +0100
| Newsgroups | gmane.text.xml.saxon.help |
|---|---|
| Message-ID | <[email protected]> |
Dear experts,
running the following XSL with Saxon-HE-10.3.jar
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:err=" http://www.w3.org/2005/xqt-errors"
exclude-result-prefixes="xs err" version="3.0">
<xsl:template match="/">
<xsl:try select="1 div 0">
<xsl:catch>
<xsl:message expand-text="yes">Failed, error code: {
$err:code }</xsl:message>
</xsl:catch>
</xsl:try>
</xsl:template>
</xsl:stylesheet>
results in the following error messages:
Static error at char 32 (in expression on line 8) of
file:/home/lambert/workspace-oxygen-23-1/test-23-1/try-catch.xsl
XPST0008 Variable err:code has not been declared (or its declaration
is not in scope)
Static error at char 32 (in expression on line 8) of
file:/home/lambert/workspace-oxygen-23-1/test-23-1/try-catch.xsl
XPST0008 Variable err:code has not been declared (or its declaration
is not in scope)
Variable err:code has not been declared (or its declaration is not in scope)
I tested the same XSL with Saxon-HE-9.9.1-7.jar as well. The overall
result is the same (XPST0008), although the older release emits the
error message only once and with slightly different text:
Static error on line 1 at column 33 (on line 8) of
file:/home/lambert/workspace-oxygen-23-1/test-23-1/try-catch.xsl
XPST0008: Variable err:code has not been declared (or its declaration
is not in scope)
Variable err:code has not been declared (or its declaration is not in scope)
From what I read at https://www.w3.org/TR/xslt-30/#element-try,
$err:code should be _implicitly_ declared within xsl:catch, so I'm a bit
puzzled by this error. What's wrong with my code?
BTW, I found an earlier report from Gunter Rademacher, who reported a
similar issue in the context of XQuery back in 2013:
https://saxon-help.markmail.org/search/?q=%24err%3Acode#query:%24err%3Acode%20from%3A%22Rademacher%2C%20Gunther%22+page:1+mid:7hwc6rnkqjah2t35+state:results
Kind regards,
Lambert
Kind regards,
Lambert