Subject: RE: [xsl] Re: Is there a way to catch Exceptions in xslt thrown from calling a Java function within Xalan ? From: "Gheste, Amit S" <Amit.Gheste@xxxxxxxxxx> Date: Mon, 1 Mar 2004 09:06:22 -0600 |
I have tried this with a VB Code, and this works with the MSXML parser, but I cannot test it with the Xalan parser as I cannot install stuff here. Anyway try this. <xsl:if test="$sometest"> <xsl:message terminate="yes">Invalid Date Format in the Begin Date</xsl:message> </xsl:if> Regards AmitGhaste 314.359.1851 -----Original Message----- From: Dimitre Novatchev [mailto:dnovatchev@xxxxxxxxx] Sent: Friday, February 27, 2004 5:04 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: [xsl] Re: Is there a way to catch Exceptions in xslt thrown from calling a Java function within Xalan ? "Bill Riegel" <BRiegel@xxxxxxx> wrote in message news:830BF4914C3C4B4EB1C438D93ABF897A0443CB@xxxxxxxxxxxxxxxxxxxxxxxx . > > > 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 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Can anyone give me the li, Jeff Kenton | Thread | [xsl] Re: Re: Is there a way to cat, Dimitre Novatchev |
Re: [xsl] Tricky White Spaces being, David Carlisle | Date | Re: AW: [xsl] unsuspected output, G. Ken Holman |
Month |