@Override
    public void startProcessing() {
        //LOGGER.trace("startProcessing called");
        try {
            Properties outputProperties = null;

            final XsltDoc xslt = loadXsltDoc();
            // If we have found XSLT then get a template.
            if (xslt != null) {

                // If no XSLT has been provided then don't try and get compiled
                // XSLT for it.
                if (xslt.getData() != null && xslt.getData().trim().length() > 0) {
                    // Get compiled XSLT from the pool.
                    final ErrorReceiver errorReceiver = new ErrorReceiverIdDecorator(getElementId(),
                            getErrorReceiver());
                    PoolItem<StoredXsltExecutable> poolItem = xsltPool.borrowConfiguredTemplate(xslt, errorReceiver,
                            locationFactory, List.of(), true);
                    final StoredXsltExecutable storedXsltExecutable = poolItem.getValue();
                    // Get the errors.
                    final StoredErrorReceiver storedErrors = storedXsltExecutable.getErrorReceiver();
                    // Get the XSLT executable.
                    XsltExecutable xsltExecutable = storedXsltExecutable.getXsltExecutable();
                    if (storedErrors.getTotalErrors() > 0) {
                        // Replay any exceptions that were created when
                        // compiling the XSLT into the pipeline error handler.
                        storedErrors.replay(errorReceiver);
                    }

                    outputProperties = xsltExecutable.getUnderlyingCompiledStylesheet().getOutputProperties();
                }
            }

            stringWriter = new CharBufferWriter();
            bufferedWriter = new BufferedWriter(stringWriter);

            final ErrorListener errorListener = new ErrorListenerAdaptor(getElementId(), locationFactory,
                    getErrorReceiver());
            final TransformerHandler th = XMLUtil.createTransformerHandler(errorListener, indentOutput);

            if (outputProperties != null) {
                th.getTransformer().setOutputProperties(outputProperties);
            }
            th.setResult(new StreamResult(bufferedWriter));
            handler = th;
            startedDocument = false;

        } catch (final TransformerConfigurationException e) {
            fatal(e);
            throw LoggedException.wrap(e);
        }

        super.startProcessing();
    }
Writes out XML and records segment boundaries as it goes.
stroom-pipeline/src/main/java/stroom/pipeline/writer/XMLWriter.java