title: XSLTProcessor.transformToDocument returns null in Chrome/Webkit
body: <p>I want to process web pages with XSLTProcessor on Chrome or Safari mobile browsers (Webkit).</p>
  
  <p>My tests worked well in Firefox but not in Chrome/Safari browsers. The function transformToDocument returns null, except with very simple documents.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;p&gt;Hello&amp;nbsp;world&lt;/p&gt;
  &lt;div&gt;transformToDocument:&lt;/div&gt;
  &lt;script&gt;
    var xmlSerializer = new XMLSerializer ();
    var domParser = new DOMParser ();
    var xsltProcessor = new XSLTProcessor ();
    var xslString = '&lt;xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;' +
        '&lt;xsl:output method="html"/&gt;' +
        '&lt;xsl:template match="//p"&gt;&lt;p&gt;&lt;i&gt;&lt;xsl:value-of select="."/&gt;&lt;/i&gt;&lt;/p&gt;&lt;/xsl:template&gt;' +
        '&lt;xsl:template match="text()"/&gt;' +
        '&lt;/xsl:transform&gt;';
    var xsl = domParser.parseFromString (xslString, 'text/xml');
    xsltProcessor.importStylesheet (xsl);
    var result = xsltProcessor.transformToDocument (document);
    console.log (result); // null with Chrome
    console.log (xmlSerializer.serializeToString (result));
    document.writeln (xmlSerializer.serializeToString (result));
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Curiously if I remove the <code>meta</code> tag and the <code>nbsp</code> entity, the sample works.</p>
  
  <p>Can you please tell me what's wrong and how to fix it.</p>