I recently had to transform an xml file into a scorm manifest file. I wanted it to be in UTF-8, but Microsoft.XMLDOM‘s transform method disregards the encoding setting in xsl:output. The transformNodeToObject method doesn’t. I also found out I had to use the save method on the output object instead of writing a file based on the xml property. You’ll find the function I ended up writing to assist me below:
<script language="javascript" runat="server"> function transformXmlFile(xmlfile, xslfile, outputfile){ var xml = new ActiveXObject("Microsoft.XMLDOM"); var xsl = new ActiveXObject("Microsoft.XMLDOM"); var out = new ActiveXObject("Microsoft.XMLDOM"); xml.async = false; xsl.async = false; out.async = false; xml.load(xmlfile); xsl.load(xslfile); xml.transformNodeToObject(xsl, out); out.save(outputfile); xml = null; xsl = null; out = null; } </script>