[xsl] RE: catching Java exceptions in saxon?

Subject: [xsl] RE: catching Java exceptions in saxon?
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 18 Apr 2002 09:37:45 +0100
> ah, I can't stop praising saxon. You've done such a fine job!
> XSLT with saxon has become my bread-and-butter scripting language.
> Can't imagine the days any more where the level of debugging help
> was the message "the parameter is incorrect" :-)
>
> I have a few questions or suggestions:
>
> I am using the Java extensibility a lot, it works wonderfully.
> It would be even nicer if XPath would be augmented so as to
> allow object oriented "dot" notation. I would say
>
>   <xsl:variable name="magic" select="$thing.getMagic()"/>
>
> and it would call the getMagic() method on the object refered
> to by the XSLT variable $thing. This would not be hard to
> implement in saxon, because it's a java engine by itself.
> Did you consider that? Sounds to me like a worthwhile extension
> of the XSLT/Xpath specification too.

I'm not prepared to do it in Saxon unless the XPath specification is changed
to allow it. And unfortunately, while the changes appear simple on the
surface, it would actually require a rather fundamental change to the
XPath/XQuery type system, which is causing us enough trouble in XPath 2.0 as
it is. In fact, even defining the simple XSLT 1.0 (or was it 1.1?)
capability for an extension function to return an external object is proving
troublesome, because we are being much stricter this time round about
formalizing the semantics of the language.

(At a syntactic level, note that "." is an ordinary character in XML names)
>
> The other thing is, couldn't there be an exception handling
> block in XSLT/saxon. For instance:
>
> <xsl:template ...>
>    <saxon:try>
>       <fortune>
>         <xsl:value-of select="magic:get-fortune($magic)"/>
>       </fortune>
>       <saxon:catch exception="java:FortuneNotFoundException()">
>          <sorry>
>            <no-luck-today/>
>          </sorry>
>       </saxon:catch>
>    </saxon:try>
> </xsl:template>
>
> Or something along those lines.
>
We've got a working paper tabled on exception handling in XPath 2.0, and one
of the things we will be looking at is whether to do it at the XPath level
or the XSLT level. I think it's very likely that there will be something
like this in XSLT 2.0/XPath 2.0, but at present I have very little idea what
it might look like.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread