I am trying to write a new emitter for a output method. This seemed to be very easy, but I think there is an error in SAXON 7.6.5.

The emitter is found, but the method setOutputStream or setWriter is never called.

Here is an excerpt from net.sf.saxon.event.ResultWrapper :
            } else if (method.equals("text")) {
                emitter = new TEXTEmitter();
                target = emitter;
            } else {
                // TODO: externally supplied properties must be validated
                int brace = method.indexOf('}');
                String localName = method.substring(brace+1);
                int colon = localName.indexOf(':');
                localName = localName.substring(colon+1);

                if (localName.equals("fop")) {
                    // avoid an explicit external reference to avoid build problems
                    // when FOP is not present on the class path
                    target = Emitter.makeEmitter("net.sf.saxon.fop.FOPEmitter");
                } else {
                    target = Emitter.makeEmitter(localName);
            if (emitter != null) {
                StreamResult sr = (StreamResult)result;
                if (sr.getWriter() != null) {
                } else if (sr.getOutputStream() != null) {
                } else {


Since only target is set when Emitter.makeEmitter is called, emitter is still null. This means that neither setWriter nor setOutputStream is called on the emitter.
Is this the correct behaviour? If it is, please tell me how to get the correct output stream.

Best regards,
Thomas Zitzler