Network maintenance. We will be observing a scheduled maintenance window to mondernize the access routers at our primary data center this Sunday, October 22, 2017 from 20:00 UTC until Monday, October 23, 03:00 UTC. Planio services may be unavailable for about 30 minutes during the maintenance window.

Bug #2677

Saxon/C PHP API getErrorMessage does not report useful error

Added by Philipp F over 1 year ago. Updated over 1 year ago.

Saxon Internal
Start date:
Due date:
% Done:


Found in version:
Fixed in version:


I am not sure if this is a bug, but if not it's a feature request :-)

When the XSLT compilation fails (for example on the XSL error I considered as bug here I don't get any useful information from getErrorMessage().

The code

$result = $saxon->transformToString();

if($result == NULL) {
    $errCount = $saxon->getExceptionCount();
    if($errCount > 0 ){
        for($i = 0; $i < $errCount; $i++) {
            $errCode = $saxon->getErrorCode(intval($i));
            $errMessage = $saxon->getErrorMessage(intval($i));
            echo 'Error: Code='.$errCode.' Message='.$errMessage;

gives the error

Error: Code=Unknown Message=net.sf.saxon.s9api.SaxonApiException : Stylesheet compilation failed: 1 error reported

in the /var/log/apache2/error.log a more useful error appears:

Error at xsl:call-template on line 11 column 37 of style.xml: XTSE0680: Parameter xxx is not declared in the called template

Is it possible to make the getErrorMessage() function retrieve this error code?


#1 Updated by O'Neil Delpratt over 1 year ago

  • Status changed from New to In Progress
  • Found in version changed from 1.0.0 / to 1.0.0

Thanks for submitting this bug issue and sending a repo. We will investigate the issue.

#2 Updated by O'Neil Delpratt over 1 year ago

  • Category set to Saxon Internal

This is indeed a bug. In the Java code we seem not to be adding the exceptions to the list of exceptions as to when they occur. The only one added is the one throw from the transform method.

I have updated the XsltProcessor class in the Java code. Unit tests are needed to check.

#3 Updated by O'Neil Delpratt over 1 year ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

#4 Updated by O'Neil Delpratt over 1 year ago

  • Status changed from Resolved to Closed
  • Fixed in version set to 1.0.1

Bug fix applied in the Saxon/C 1.0.1 maintenance release.

Please register to edit this issue

Also available in: Atom PDF