JSFiddle - React, Tailwind, and code Playground
JavaScript
var stylesheetXml =
'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' +
'<xsl:template match="/">' +
'<div>' +
'<xsl:value-of select=\'translate("Simple sting line"," ","_")\'/>' +
'</div>' +
'</xsl:template>' +
'</xsl:stylesheet>';
var stylesheet = (new window.DOMParser()).parseFromString(stylesheetXml, "text/xml");
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(stylesheet);
var empty = (new window.DOMParser()).parseFromString("", "text/xml");
var output = xsltProcessor.transformToDocument(empty);
var outputXml = (new XMLSerializer()).serializeToString(output)
document.write(outputXml);