Bug #4760


Streaming from the command line doesn't work if the stylesheet is compiled to a SEF file

Added by Michael Kay over 1 year ago. Updated over 1 year ago.

Start date:
Due date:
% Done:


Estimated time:
Legacy ID:
Applies to branch:
10, trunk
Fix Committed on Branch:
10, trunk
Fixed in Maintenance Release:


When a transformation is invoked from the command line, with a source document and stylesheet, where the initial mode is a streamable mode, then if the stylesheet is supplied as a SEF file, the transformation runs, but doesn't use streaming: it produces the message

  SXWN9000  The unnamed mode is streamable, but the input is not supplied as a stream

For more details see

Actions #1

Updated by Michael Kay over 1 year ago

When the stylesheet is supplied from source code, at Transform#1264 pss.getGlobalContextRequirement() returns null, so buildSourceTree is false; when it is supplied from a SEF file, it returns a non-null GlobalContextRequirement with absentFocus=false, so buildSourceTree is true.

Actions #2

Updated by Michael Kay over 1 year ago

The test case can be fixed by ensuring that PackageLoaderHE.readGlobalContext doesn't create a GlobalContextRequirement in the rebuilt package if there is no <glob/> entry in the SEF file.

It just remains to create a regression test...

Actions #3

Updated by Michael Kay over 1 year ago

Attempting to test this in a JUnit test, verifying that no warnings are output.

This encounters a different problem. If I set an initializer that calls Configuration.setLogger(), then Verifier fails with an NPE trying to display the license message. The license message is sent to config.getStandardErrorOutput(), which is null if a Logger has been set. The implication is that config.setLogger() simply doesn't work. At any rate, the relationship of config.setStandardErrorOutput() and config.setLogger() is complex and poorly explained.

Tried getting around this by making the Logger extend StandardErrorLogger, but that doesn't work either, because the ErrorReporter used by the run-time Controller doesn't use the Logger registered with the Configuration.

So I'm coming to the conclusion that when running from the command line, there's no way to redirect warnings to a destination other than System.err, which makes this test rather hard to write.

I found another way to write the test: register an Initializer which registers a SourceResolver; the SourceResolver detects that the supplied Source is an in-memory document tree rather than a stream. I'll raise a separate bug on the Logger issues.

Actions #4

Updated by Michael Kay over 1 year ago

  • Status changed from New to Resolved
  • Applies to branch 10, trunk added
  • Fix Committed on Branch 10, trunk added


Actions #5

Updated by O'Neil Delpratt over 1 year ago

Bug fix applied in the Saxon 10.3 maintenance release

Actions #6

Updated by O'Neil Delpratt over 1 year ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.3 added

Please register to edit this issue

Also available in: Atom PDF