title: XSLT document function doesn't work in chrome
body: <p>I am trying to transform a XSLT using Javascript and trying to get it to work on Both Chrome and IE. Entry page is <code>a.html</code>. It's working fine in IE (both native/compatibility mode) but doesn't work in Chrome correctly i.e. dropdown is not created with options.</p>
  
  <p>In chrome, however, if I open <code>data.xml</code> which has:</p>
  
  <pre><code>&lt;?xml-stylesheet type="text/xsl" href="render.xslt" ?&gt;
  </code></pre>
  
  <p>directly in chrome, it is transformed perfectly fine. But if I try to do that same using XSLTProcessor, it doesn't work. Specifically, the <code>document</code> function doesn't work. Could you please help?</p>
  
  <p>My code is as follows.</p>
  
  <p>Javascript:</p>
  
  <pre class="lang-js prettyprint-override"><code>var MSXML2_DOMDocument_6 = "MSXML2.DOMDocument.6.0";
  function tranform(xml, xsl) {
      if (window.ActiveXObject || "ActiveXObject" in window) {
          var xmlSerializer = new XMLSerializer();
          var xmlString = xmlSerializer.serializeToString(xml);
          var xslString = xmlSerializer.serializeToString(xsl);
  
          var xsl = new ActiveXObject(MSXML2_DOMDocument_6);
          xsl.setProperty("AllowXsltScript", true);
          xsl.setProperty("AllowDocumentFunction", true);
          xsl.resolveExternals = true;
          xsl.async = false;
          xsl.loadXML(xslString);
  
          var xml = new ActiveXObject(MSXML2_DOMDocument_6);
          xml.resolveExternals = true;
          xml.preserveWhiteSpace = true;
          xml.async = false;
          xml.loadXML(xmlString);
          xml.resolveExternals = true;
  
          ex = xml.transformNode(xsl);
          document.getElementById("example").innerHTML = ex;
      } else if (document.implementation &amp;&amp; document.implementation.createDocument) {
          xsltProcessor = new XSLTProcessor();
          xsltProcessor.importStylesheet(xsl);
          resultDocument = xsltProcessor.transformToFragment(xml, document);
          document.getElementById("example").appendChild(resultDocument);
      }
  }
  
  function loadXMLDoc() {
  
      $.ajax({
          method: "GET",
          url: "data.xml",
          dataType: "xml"
      }).then(function (xml) {
              console.log("done xml")
              $.ajax({
                  method: "GET",
                  url: "render.xslt",
                  dataType: "xml"
              }).then(function (xsl) {
                  console.log("done xsl")
                  tranform(xml, xsl)
              })
          },
          function (e) {
              console.log("Got error in xml", e.status)
          })
  }
  
  $(loadXMLDoc)
  </code></pre>
  
  <p>foo/b.xml:</p>
  
  <pre><code>&lt;dropdowns&gt;
    &lt;dropdown name="xyz"&gt;
      &lt;option value="I"&gt;Info&lt;/option&gt;
      &lt;option value="C"&gt;Category&lt;/option&gt;
    &lt;/dropdown&gt;
  &lt;/dropdowns&gt;
  </code></pre>
  
  <p>data.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;?xml-stylesheet type="text/xsl" href="render.xslt" ?&gt;
  &lt;catalog name="xyz" /&gt;
  </code></pre>
  
  <p>a.html:</p>
  
  <pre><code>&lt;html lang="en"&gt;
  
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
      &lt;script src="jquery-3.3.1.js"&gt;&lt;/script&gt;
      &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;div id="example"&gt;&lt;/div&gt;
      &lt;script src="b.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>render.xslt:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
      &lt;xsl:import href="util.xslt" /&gt;
      &lt;xsl:output method="html"&gt;&lt;/xsl:output&gt;
      &lt;xsl:template match="/"&gt;
          &lt;h1&gt;
              &lt;xsl:value-of select="/catalog/@name"&gt;&lt;/xsl:value-of&gt;
          &lt;/h1&gt;
          &lt;xsl:call-template name="dropdown"&gt;
              &lt;xsl:with-param name="listname"&gt;xyz&lt;/xsl:with-param&gt;
              &lt;xsl:with-param name="value" select="/catalog/@name"/&gt;
          &lt;/xsl:call-template&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>util.xslt:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet 
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
      &lt;xsl:output method="html"&gt;&lt;/xsl:output&gt;
      &lt;xsl:template name="dropdown"&gt;
          &lt;xsl:param name="listname"/&gt;
          &lt;xsl:param name="value"/&gt;
          &lt;select&gt;
              &lt;xsl:for-each select="document('foo/b.xml')/dropdowns/dropdown[@name=$listname]/option"&gt;
                  &lt;option&gt;
                      &lt;xsl:attribute name="value"&gt;
                          &lt;xsl:value-of select="@value"/&gt;
                      &lt;/xsl:attribute&gt;
                      &lt;xsl:value-of select="."/&gt;
                  &lt;/option&gt;
              &lt;/xsl:for-each&gt;
          &lt;/select&gt;
      &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I am sorry it's a bit long to be an MVE example but it's complete.</p>
  
  <p>Please let me know if any clarification required.</p>