Bug #2677
closedSaxon/C PHP API getErrorMessage does not report useful error
100%
Description
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 https://saxonica.plan.io/issues/2676) 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;
}
$saxon->exceptionClear();
}
}
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?
Updated by O'Neil Delpratt almost 9 years ago
- Status changed from New to In Progress
- Found in version changed from 1.0.0 / 9.6.0.9 to 1.0.0
Thanks for submitting this bug issue and sending a repo. We will investigate the issue.
Updated by O'Neil Delpratt almost 9 years 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.
Updated by O'Neil Delpratt over 8 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
Updated by O'Neil Delpratt over 8 years 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