using xslt/JS inside the page

Nic Ferrier <[email protected]>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization Tapsell-Ferrier Limited
Message-ID <[email protected]>
Here's an HTML document:

  <html>
  <head>
  <script>
      var proc = new XSLTProcessor();
      var xslt = document.implementation.createDocument("", "", null);
      xslt.innerHTML = "<?xml version='1.0'?>"
      + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0>"
          + "<xsl:output method='html'/>"
          + "<xsl:template match='/test'><p>goodbye!</p></xsl:template>"
          + "</xsl:stylesheet>";
      proc.importStylesheet(xslt);

      var src_doc = document.implementation.createDocument("", "", null);
      src_doc.innerHTML = "<?xml version='1.0'?>"
      + "<test>"
          + "<item><title>hello!</title><link>someplace</link></item>"
          + "<item><title>hello to you too!</title><link>otherplace</link></item>"
          + "</test>";
      var result = proc.transformToFragment(src_doc, document);
      alert(result);
      alert(result.innerHTML);
  </script>
  </head>
  <body>
      <h1>hello</h1>
  </body>
  </html>


result.innerHTML is null and looking at result it looks like it has no
children, where it should have one: a text node saying "goodbye".

Anybody know why this is?


Nic Ferrier
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.