Created
October 6, 2021 16:17
-
-
Save ericlaw1979/deb716d8436890420c41c8a593bfd509 to your computer and use it in GitHub Desktop.
Transform XML+XSLT to plain html so that it loads without blocking (see https://textslashplain.com/2019/10/09/navigating-to-file-urls/ )
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Filenames | |
var sXML = "U_MS_Edge_V1R3_STIG_Manual-xccdf.xml"; | |
var sXSLT = "STIG_unclass.xsl"; | |
var sOutput = "TransformedHTML.html"; | |
var fso, f, xmlstr, xsltstr; | |
fso = new ActiveXObject("Scripting.FileSystemObject"); | |
f = fso.OpenTextFile(sXML); | |
xmlstr = f.ReadAll(); | |
f.Close(); | |
f = fso.OpenTextFile(sXSLT); | |
xsltstr = f.ReadAll(); | |
f.Close(); | |
var xmldom, xsltdom; | |
try { | |
xmldom = new ActiveXObject("Msxml2.DOMDocument.6.0"); | |
xmldom.validateOnParse = true; | |
xmldom.async = false; | |
xmldom.loadXML(xmlstr); | |
xsltdom = new ActiveXObject("Msxml2.DOMDocument.6.0"); | |
xsltdom.validateOnParse = true; | |
xsltdom.async = false; | |
xsltdom.loadXML(xsltstr); | |
output = xmldom.transformNode(xsltdom); | |
f = fso.CreateTextFile(sOutput); | |
xsltstr = f.Write(output); | |
f.Close(); | |
WScript.echo("Transformed [" + sXML + "] with [" + sXSLT +"] to make [" + sOutput + "]"); | |
} | |
catch(err) { | |
WScript.echo(err.description); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment