Re: [xsl] loggin SAXON errors

Subject: Re: [xsl] loggin SAXON errors
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Mon, 14 Nov 2011 12:24:22 +0000
On 14/11/2011 11:51, Bartolomeo Nicolotti wrote:
To whom it may concern,

we use SAXON 2.0 XSLT engine from Java. Is there a way to redirect this
kind of errors:

Sure. You can write your own ErrorListener. Details depend on the API you are using; if it's JAXP, this is a run-time error, so the ErrorListener in question is the one you nominate to the Transformer object. (For compile time errors, you would have to set the ErrorListener on the TransformerFactory, though for Saxon, you can specify a different ErrorListener for each compilation by using Saxon-specific interfaces).


Alternatively, you can get the ErrorListener that Saxon is using, cast it to net.sf.saxon.lib.StandardErrorListener, and then call its setErrorOutput() method to set a different output destination.

Just remember that you need to consider both compile-time and run-time errors, and the mechanisms are slightly different.

Michael Kay
Saxonica

Error on line 367 of Albatravel_OTA_HotelAvailRS2OTA_HotelAvailRS.xslt: XPTY0004: A sequence of more than one item is not allowed as the second operand of 'to' (1, 1) at xsl:for-each (file:///usr/local/tomcat/webapps/WS_DynPkg_1_6_1//xslt/OTA2OTAAlbatravel/Albatravel_OTA_HotelAvailRS2OTA_HotelAvailRS.xslt#66)

processing /siap-concat/envelope[1]/response[1]/hotels[1]/hotel[1]/agreement[1]
   at xsl:for-each
(file:///usr/local/tomcat/webapps/WS_DynPkg_1_6_1//xslt/OTA2OTAAlbatravel/Albatravel_OTA_HotelAvailRS2OTA_HotelAvailRS.xslt#52)
      processing /siap-concat/envelope[1]/response[1]/hotels[1]/hotel[1]
OTA_literal_HttpPost class
com.siap.DPKWebServices.Util.OTA_literal_HttpPost.queryHttp( String
uri=http://kalima.worldwidehotelink.com/call.php,
OTA_HotelAvail )net.sf.saxon.trans.XPathException: A sequence of more
than one item is not allowed as the second operand of 'to' (1, 1)

from Standard in to a String so that we can put then in a log?

Many thanks

Best regards

Bartolomeo

Current Thread