public XsltDoc loadXsltDoc() {

        final DocFinder<XsltDoc> docFinder = new DocFinder<>(
                XsltDoc.TYPE,
                pathCreator,
                xsltStore,
                docRefInfoService);
        final DocRef docRef =
                docFinder.findDoc(
                        xsltRef,
                        xsltNamePattern,
                        getFeedName(),
                        getPipelineName(),
                        message -> getErrorReceiver().log(
                                Severity.WARNING, null, getElementId(), message, null),
                        suppressXSLTNotFoundWarnings);

        if (docRef != null) {
            final XsltDoc xsltDoc = xsltStore.readDocument(docRef);
            if (xsltDoc == null) {
                final String message = "XSLT \"" +
                        docRef.getName() +
                        "\" appears to have been deleted";
                throw ProcessException.create(message);
            }

            return xsltDoc;
        }

        return null;
    }
Writes out XML and records segment boundaries as it goes.
stroom-pipeline/src/main/java/stroom/pipeline/writer/XMLWriter.java