private void fireRemainingEvents() throws SAXException {
        if (!hasFiredEvents) {
            super.startDocument();
            fireStartEvents(0, length);
            fireEndEvents(length, 0);
            super.endDocument();

        } else if (count > 0) {
            // Fire all end events as the XML will not have been closed off if
            // currentCount > 0.
            fireEndEvents(afterRoot, 0);
            super.endDocument();
        }
    }
Ideally we would only call this method on endProcessing() which would
allow us to supply the XSLT filter with events that span multiple streams
within an aggregate and so improve translation performance, however this
is not possible as some translations fetch meta and context data during
translation which is no longer valid when endProcessing() is called.
Instead it will still be necessary for endDocument() to call this method
instead unless we can figure out a way of the XSLT filter knowing which
sub stream it is currently processing and opening the appropriate one.
stroom-pipeline/src/main/java/stroom/pipeline/filter/SplitFilter.java