Hi Henry,

That's worked.  Thank you so much.

Stephen
Stephen P Harper 
PTP Feeds Build
GDP 228 5706 | Direct +44 141 228 5706 | Email 
[EMAIL PROTECTED] 




Henry Zongaro <[EMAIL PROTECTED]> 
13/12/2007 14:35

To
[EMAIL PROTECTED]
cc
xalan-j-users@xml.apache.org
Subject
Re: Issue trying to extract errors from XSLTs in Java







Hi, Stephen. 

[EMAIL PROTECTED] wrote on 2007-12-11 11:09:58 AM: 
> So here is my code.  In my stylesheet I throw an error for whatever 
reason: 
> 
> <xsl:message terminate="yes">Error thrown</xsl:message> 
> 
> And in my Java code I attempt to catch and extact the error message: 
> 
> } catch (TransformerException e) { 
>         log.debug("Exception Caught during XSLT processing. 
> Message: " + e.getMessage() + ", Location: " + e.getLocationAsString()); 

> } 
> 
> The following line is printed out, but I don't know where from.  I 
> need to capture this information and log it: 
> 
> file:///C:/xxx/xxx.xsl; Line #171; Column #35; Error thrown 

The Xalan-J processors report the message produced for an xsl:message 
instruction ("Error thrown" in this case) through the "warning" method of 
any ErrorListener installed on the Transformer.  The effect of the 
termination is then reported through ErrorListener.fatalError (with the 
message "Stylesheet directed termination").  If you install an 
ErrorListener, you should be able to log the messages received through any 
of the three methods. 

You can use TransformerException.getLocationAsString() or 
TransformerException.getMessageAndLocation() to get the system ID, line 
and column number of the xsl:message. 

I hope that helps. 

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 313-6044;  Phone +1 905 413-6044
mailto:[EMAIL PROTECTED]


-----------------------------------------
This communication is for informational purposes only. It is not
intended as an offer or solicitation for the purchase or sale of
any financial instrument or as an official confirmation of any
transaction. All market prices, data and other information are not
warranted as to completeness or accuracy and are subject to change
without notice. Any comments or statements made herein do not
necessarily reflect those of JPMorgan Chase & Co., its subsidiaries
and affiliates.

This transmission may contain information that is privileged,
confidential, legally privileged, and/or exempt from disclosure
under applicable law. If you are not the intended recipient, you
are hereby notified that any disclosure, copying, distribution, or
use of the information contained herein (including any reliance
thereon) is STRICTLY PROHIBITED. Although this transmission and any
attachments are believed to be free of any virus or other defect
that might affect any computer system into which it is received and
opened, it is the responsibility of the recipient to ensure that it
is virus free and no responsibility is accepted by JPMorgan Chase &
Co., its subsidiaries and affiliates, as applicable, for any loss
or damage arising in any way from its use. If you received this
transmission in error, please immediately contact the sender and
destroy the material in its entirety, whether in electronic or hard
copy format. Thank you.

Please refer to http://www.jpmorgan.com/pages/disclosures for
disclosures relating to UK legal entities.

Reply via email to