@SuppressWarnings("unused") //useful for debugging
    private static String truncateAndStripWhitespace(String str) {
        //remove any line breaks and white space, accepting that white space in element text or attributes will be lost
        //but is this is intended for debugging that is ok.
        String truncatedStr = str
                .replaceAll("\\s+", "")
                .replace("\n", "");
        if (truncatedStr != null) {
            int strLen = truncatedStr.length();
            if (strLen > 100) {
                truncatedStr = String.format("%s..TRUNCATED..%s",
                        truncatedStr.substring(0, 45),
                        truncatedStr.substring(strLen - 45));
            }
        } else {
            truncatedStr = "NULL";
        }
        return truncatedStr;
    }
Used when XSLT is supplied (for xsl:output)
stroom-pipeline/src/main/java/stroom/pipeline/writer/XMLWriter.java