Streaming from the command line doesn't work if the stylesheet is compiled to a SEF file
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
Warning SXWN9000 The unnamed mode is streamable, but the input is not supplied as a stream
For more details see https://saxonica.plan.io/boards/3/topics/8001
#1 Updated by Michael Kay 7 months 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
buildSourceTree is true.
#3 Updated by Michael Kay 7 months 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.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.
Please register to edit this issue