https://saxonica.plan.io/https://saxonica.plan.io/favicon.ico2019-12-04T10:48:12ZSaxonica Developer CommunitySaxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=145822019-12-04T10:48:12ZMichael Kaymike@saxonica.com
<ul></ul><p>saxon:transform() is pretty ancient and rather reflects the old XSLT 1.0 processing model where there is always one source document. Have you considered using the standard XSLT 3.0 fn:transform() function instead, which is much more flexible?</p>
<p>Of course we should fix any crash.</p>
<p>One word of caution about chaining transformations in this way: because you're invoking one transformation before the other has finished, it can be heavy on memory use (the internal state of the first transformation, including the source document tree, is there for the duration of the second, even if it is never going to be used again). Piping the results of one transformation to another using SAX-like events, e.g. at the s9api level using one XsltTransformer as the destination of another, is potentially more efficient.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=145872019-12-05T18:40:36ZJohan Gheys
<ul></ul><p>We use the standard XSLT 3.0 fn:transform () function already as much as possible (see example 1), but this function has no parameter to directly write secondary result documents to the filestore. Such documents are accumulated in memory together with the primary output document, after which writing can only begin. This means a considerable memory consumption, especially when it concerns a large number of documents with a large volume. In these specific cases we hope to be able to use the saxon:transform () function so that the secondary output can be serialized directly to the filestore.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=145882019-12-05T18:56:58ZMichael Kaymike@saxonica.com
<ul></ul><p>Thanks, that's useful feedback.</p>
<p>The specification of result document handling in fn:transform() was a significant challenge because the WG didn't want to define some half-baked side-effect mechanism; delegating the disposal of secondary result documents to a user-written function was a way of basically offloading the problem onto implementors, who presumably already have their own workarounds for handling calls to external functions with side effects.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=145902019-12-05T19:04:27ZJohan Gheys
<ul></ul><p>Thank you for the clarifying background information. I understand that an additional parameter would not be a good solution. Hopefully we can still count on a well-functioning saxon:transform() function in the future.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=146232019-12-09T09:38:20ZJohan Gheys
<ul></ul><p>Small additional question: when using the standard XSLT 3.0 fn:transform() function with the additional option source-location provided by Saxon, we notice a different behavior compared to the stylesheet-location option. The stylesheet-location option seems to use the standard URIResolver; the source-location option not. The documentation doesn't mention any different behavior.
What are the rules to correctly use the source-location option?</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=148862020-02-06T12:26:08ZMichael Kaymike@saxonica.com
<ul></ul><p>Sorry for the delay in progressing this.</p>
<p>There were various paths in which the implementation of the call() method was returning null rather than an EmptySequence, which is incorrect. The documentation also needs to be updated to indicate that saxon:transform() can return an empty sequence if the stylesheet generates no principal output.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=148872020-02-06T12:36:01ZMichael Kaymike@saxonica.com
<ul><li><strong>Category</strong> set to <i>Saxon extensions</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>In Progress</i></li><li><strong>Assignee</strong> set to <i>Michael Kay</i></li><li><strong>Applies to branch</strong> <i>9.9, trunk</i> added</li><li><strong>Fix Committed on Branch</strong> <i>9.9, trunk</i> added</li></ul><p>Code patched on 9.9 and trunk: TransformFn.call() returns ZeroOrOne rather than NodeInfo, and returns empty sequence instead of null when there is no result. Function signature updated to make the result optional. Documentation updated on trunk only.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=148882020-02-06T12:51:18ZMichael Kaymike@saxonica.com
<ul><li><strong>Status</strong> changed from <i>In Progress</i> to <i>Resolved</i></li></ul><p>As regards fn:transform and source-location, yes, I think we should be using the URIResolver. A more significant omission is that we don't seem to be setting the base URI for resolving a relative source-location, which means it's going to resolve against the current directory rather than the static base URI. I have fixed both these issues.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=148932020-02-06T18:12:04ZJohan Gheys
<ul></ul><p>No problem for the delay. Your support is always appreciated.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=150022020-03-05T10:09:43ZO'Neil Delprattoneil@saxonica.com
<ul><li><strong>Status</strong> changed from <i>Resolved</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li><li><strong>Fixed in Maintenance Release</strong> <i>9.9.1.7</i> added</li></ul><p>Patch applied in the 9.9.1.7 maintenance release.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=195942022-02-19T15:04:54ZJohan Gheys
<ul></ul><p>The problem is back in version 11.2:</p>
<pre><code>D:\Data\MyProjects\upmb\upm-batch\src\test\resources\saxon\saxon-transform>java -jar D:\Data\MyProjects\upmb\upm-batch\src\test\lib\saxon-ee-11.2.jar -xsl:xsl/batch-with-saxon.xslt -config:config/saxon-config.xml -it !method=text
Launching remove-past-versions.xslt
parameter file-names=ptcar region
parameter purge-date=2019-12-01
parameter xml-folder=D:/Data/MyProjects/upmb/upm-batch/src/test/resources/saxon/saxon-transform/xml/
java.lang.RuntimeException: Internal error evaluating function shared:transform-with-saxon at line 171 in module file:/D:/Data/MyProjects/upmb/upm-batch/src/test/resources/saxon/saxon-transform/xsl/shared-functions.xslt
at net.sf.saxon.expr.instruct.UserFunction.call(UserFunction.java:660)
at net.sf.saxon.expr.UserFunctionCall.callFunction(UserFunctionCall.java:555)
at net.sf.saxon.expr.UserFunctionCall.evaluateItem(UserFunctionCall.java:487)
at net.sf.saxon.expr.parser.Evaluator$SingleItem.evaluate(Evaluator.java:179)
at net.sf.saxon.expr.parser.Evaluator$SingleItem.evaluate(Evaluator.java:167)
at net.sf.saxon.expr.instruct.WithParam.getSelectValue(WithParam.java:317)
at net.sf.saxon.expr.instruct.Instruction.assembleParams(Instruction.java:204)
at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:429)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
at net.sf.saxon.expr.instruct.CallTemplate$CallTemplatePackage.processLeavingTail(CallTemplate.java:561)
at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:386)
at net.sf.saxon.expr.instruct.CallTemplate.processLeavingTail(CallTemplate.java:446)
at net.sf.saxon.expr.instruct.Block.processLeavingTail(Block.java:755)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:266)
at net.sf.saxon.trans.XsltController.callTemplate(XsltController.java:873)
at net.sf.saxon.s9api.Xslt30Transformer.callTemplate(Xslt30Transformer.java:483)
at net.sf.saxon.Transform.processFile(Transform.java:1380)
at net.sf.saxon.Transform.doTransform(Transform.java:869)
at net.sf.saxon.Transform.main(Transform.java:81)
</code></pre> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=195992022-02-20T23:44:30ZMichael Kaymike@saxonica.com
<ul></ul><p>You seem to have introduced a configuration file that's not present in the original repro, so I'm having trouble running this.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=196032022-02-21T08:53:50ZJohan Gheys
<ul><li><strong>File</strong> <a href="/attachments/55455">saxon-config.xml</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/55455/saxon-config.xml">saxon-config.xml</a> added</li></ul><p>Sorry, I thought all the files had been uploaded last time.</p> Saxon - Bug #4403: Internal error when calling saxon:transform() with stylesheet without primary outputhttps://saxonica.plan.io/issues/4403?journal_id=204402022-05-02T07:26:21ZJohan Gheys
<ul></ul><p>The command line option -config:config/saxon-config.xml can even be deleted as it is not needed to reproduce the problem. We hope the solution to this problem will be available soon so that we can switch to Saxon version 11.x.</p>