{"id":41,"date":"2007-10-31T16:24:56","date_gmt":"2007-10-31T14:24:56","guid":{"rendered":"http:\/\/www.crydust.be\/blog\/2007\/10\/31\/xslt-transform-in-asp-with-microsoftxmldom\/"},"modified":"2007-10-31T16:24:56","modified_gmt":"2007-10-31T14:24:56","slug":"xslt-transform-in-asp-with-microsoftxmldom","status":"publish","type":"post","link":"https:\/\/www.crydust.be\/blog\/2007\/10\/31\/xslt-transform-in-asp-with-microsoftxmldom\/","title":{"rendered":"XSLT transform in asp with Microsoft.XMLDOM"},"content":{"rendered":"<p>I recently had to transform an xml file into a scorm manifest file. I wanted it to be in UTF-8, but <em>Microsoft.XMLDOM<\/em>&#8216;s transform method disregards the <em>encoding<\/em> setting in <em>xsl:output<\/em>. The <em>transformNodeToObject<\/em> method doesn&#8217;t. I also found out I had to use the <em>save<\/em> method on the output object instead of writing a file based on the <em>xml<\/em> property. You&#8217;ll find the function I ended up writing to assist me below:<\/p>\n<p><!--more--><\/p>\n<pre class=\"prettyprint\">&lt;script language=&quot;javascript&quot; runat=&quot;server&quot;&gt;\r\nfunction transformXmlFile(xmlfile, xslfile, outputfile){\r\n    var xml = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);\r\n    var xsl = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);\r\n    var out = new ActiveXObject(&quot;Microsoft.XMLDOM&quot;);\r\n    xml.async = false;\r\n    xsl.async = false;\r\n    out.async = false;\r\n    xml.load(xmlfile);\r\n    xsl.load(xslfile);\r\n    xml.transformNodeToObject(xsl, out);\r\n    out.save(outputfile);\r\n    xml = null;\r\n    xsl = null;\r\n    out = null;\r\n}\r\n&lt;\/script&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I recently had to transform an xml file into a scorm manifest file. I wanted it to be in UTF-8, but <em>Microsoft.XMLDOM<\/em>&#8216;s transform method disregards the <em>encoding<\/em> setting in <em>xsl:output<\/em>. The <em>transformNodeToObject<\/em> method doesn&#8217;t. I also found out I had to use the <em>save<\/em> method on the output object instead of writing a file based on the <em>xml<\/em> property. You&#8217;ll find the function I ended up writing to assist me below:<\/p>\n<p> <a href=\"https:\/\/www.crydust.be\/blog\/2007\/10\/31\/xslt-transform-in-asp-with-microsoftxmldom\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-41","post","type-post","status-publish","format-standard","hentry","category-asp"],"_links":{"self":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts\/41","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/comments?post=41"}],"version-history":[{"count":0,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/posts\/41\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/media?parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/categories?post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.crydust.be\/blog\/wp-json\/wp\/v2\/tags?post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}