Project

Profile

Help

Support #2425

closed

Not all xsl output is captured for use in PHP

Added by Brett Merrick over 8 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
High
Category:
PHP API
Start date:
2015-07-25
Due date:
% Done:

0%

Estimated time:
Found in version:
0.3.1
Platforms:

Description

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 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

Files

Archive.zip (6.09 KB) Archive.zip sample xml, xsl and php to demonstrate issue Brett Merrick, 2015-07-25 07:36

Please register to edit this issue

Also available in: Atom PDF