Support #2425
Updated by O'Neil Delpratt over 2 years ago
We use xsl to validate supplied xml. It outputs useful debugging info when a xml file processed with it fails. When the attached saxonex.php is run from the cli, the following info is printed to stdout, but it doesn't seem to be able to be captured for use within PHP. I can verify it is not output generated or seen by PHP by wrapping the processor in an ob_start(), ob_end_clean() - the xsl output I require is still displayed, excluding the final line produced by php. Attached are the files and script I am testing with. The example xml file should fail and produce the following output indicating that the last <class></class> tag is empty: ~~~ # php saxonex.php ErrorMessage: Error! Content of element ClassParticipation // Class must not be empty. Please contact your software supplier's helpdesk with this error message /ErrorMessage: TechnicalErrorMessage: Content of element ClassParticipation // Class must not be empty. Please contact your software supplier's helpdesk with this error message /TechnicalErrorMessage: XPath : /SmsStudentMembership/Person[1]/ClassParticipation[8]/Class[2] Error at xsl:message on line 204 of foo.xsl: XTMM9000: Processing terminated by xsl:message at line 204 in foo.xsl Exception in thread "main" net.sf.saxon.s9api.SaxonApiException: Processing terminated by xsl:message at line 204 in foo.xsl at net.sf.saxon.s9api.XsltTransformer.transform(Unknown Source) at net.sf.saxon.option.cpp.XsltProcessorForCpp.xsltApplyStylesheet(Unknown Source) Caused by: net.sf.saxon.expr.instruct.TerminationException: Processing terminated by xsl:message at line 204 in foo.xsl at net.sf.saxon.expr.instruct.Message.processLeavingTail(Unknown Source) at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Unknown Source) at net.sf.saxon.expr.LetExpression.processLeavingTail(Unknown Source) at net.sf.saxon.expr.instruct.Template.applyLeavingTail(Unknown Source) at net.sf.saxon.trans.Mode.applyTemplates(Unknown Source) at net.sf.saxon.Controller.transformDocument(Unknown Source) at net.sf.saxon.Controller.transform(Unknown Source) ... 2 more Expected error: Code=XTMM9000 Message=Processing terminated by xsl:message at line 204 in foo.xsl ~~~