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

Java exception handling in XSLT is possible (and darn

Subject: Java exception handling in XSLT is possible (and darn useful!)
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 02 Dec 2002 14:14:51 -0500
java exception
Hi, I have code I'm willing to share. This code implements Java
exception handling in XSLT for Saxon and Saxon v7. Here is
an example (given the namespace prefix "ex" is define with the URL
http://regenstrief.org/org.regenstrief.saxon7.ExceptionElementFactory
the thing works as follows:

  <ex:try>
     <!-- do something that could fail -->

    <ex:catch exception="java.lang.NullPointerException">
      <xsl:message terminate="no">
        <WARNING exception="{ex:current-exception()}"/>
      </xsl:message>
    </ex:catch>
    <ex:catch exception="my.package.ReallyBadException">
      <ex:throw select="ex:current-exception()"/>
    <ex:catch>
  <ex:try>

and you can have more ex:catch blocks inside the ex:try element
to get particular types of exceptions (specified as java
fully qualified class names in ex:catch/@exception attribute.

If you want to use this code, please respond to the list in
public (I want a public show of hands.) I am glad to share the
code, but I would prefer to integrate it into Saxon or any
other XSLT package (I suppose it's quite easy to transfer
into Xalan -- just haven't had the time to worry about
Xalan and it's internals) instead of a free-floating snippet.

best regards,
-Gunther

--
Gunther Schadow, M.D., Ph.D.                    gschadow@xxxxxxxxxxxxxxx
Medical Information Scientist      Regenstrief Institute for Health Care
Adjunct Assistant Professor        Indiana University School of Medicine
tel:1(317)630-7960                         http://aurora.regenstrief.org



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


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.