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

Re: Is there a way to catch Exceptions in xslt thrown

Subject: Re: Is there a way to catch Exceptions in xslt thrown from calling a Java function within Xalan ?
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Sat, 28 Feb 2004 00:03:53 +0100
xslt exceptions
"Bill Riegel" <BRiegel@xxxxxxx> wrote in message
news:830BF4914C3C4B4EB1C438D93ABF897A0443CB@xxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> Have the template below that I use with Xalan.
> Its purpose is to read a date string in one format and convert to another
> format. But if/when the input data does not match the input format an
> exception is thrown and the entire translation stops. Is there a way to
> catch the exception ?

Neither XSLT 1.0 nor XSLT 2.0 defines any exception throwing/handling
mechanism.

You can achieve this by catching the exception in your Java code and
returning a special value, which the XSLT code must then recognize and take
appropriate action.

A good technique would be to have and only call from the XSLT code one
general "despatcher" function, passing to it as parameters the name and
parameters for the actual function to be called.

Then the exception handling logic and the returning of the appropriate
special value can be implemented centrally, only in the "despatcher" thus
avoiding the need to reproduce this exception handling logic in any new
extension function that has to be written.

Of course, before even starting coding this one must clearly understand that
handling such an error condition in the XSLT code will really be meaningful
(e.g. there is a possibility of a graceful recovery and continuing the
processing) . Most often this is not the case.


Cheers,

Dimitre Novatchev [XML MVP],
FXSL developer, XML Insider,

http://fxsl.sourceforge.net/ -- the home of FXSL
Resume: http://fxsl.sf.net/DNovatchev/Resume/Res.html




 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.