JavaScript XSLTProcessor ocasionalmente no funciona

El siguiente JavaScript supone leer las etiquetas populares de un archivo XML y aplica la hoja de estilos XSL y la salida al navegador como HTML.

<code>function ShowPopularTags() {
   xml = XMLDocLoad("http://localhost/xml/tags/popular.xml?s=94987898");
   xsl = XMLDocLoad("http://localhost/xml/xsl/popular-tags.xsl");
   if (window.ActiveXObject) {
      // code for IE
      ex = xml.transformNode(xsl);
      ex = ex.replace(/\\/g, "");
      document.getElementById("popularTags").innerHTML = ex;
   } else if (document.implementation && document.implementation.createDocument) {
      // code for Mozilla, Firefox, Opera, etc.
      xsltProcessor = new XSLTProcessor();
      xsltProcessor.importStylesheet(xsl);
      resultDocument = xsltProcessor.transformToFragment(xml, document);
      document.getElementById("popularTags").appendChild(resultDocument);
      var ihtml = document.getElementById("popularTags").innerHTML;
      ihtml = ihtml.replace(/\\/g, "");
      document.getElementById("popularTags").innerHTML = ihtml;
   }
}
ShowPopularTags();
</code>

El problema con este script es que en algún momento logra generar el código HTML resultante, y en otras ocasiones no. ¿Alguien sabe dónde va mal?

Respuestas a la pregunta(5)

Su respuesta a la pregunta