Re: Permission denied to call method XMLDocument.load

"Daniel Frechette" <daniel_@_treknowledge_._com>
Newsgroups gmane.comp.mozilla.devel.layout.xslt
Organization TreKnowledge Inc.
Message-ID <[email protected]>
I added an "onload" event handler, but the event handler function "onload()" 
never gets called. Why?

Here is the latest version of my code (you can also access it at 
http://treknowledge.com/dmsxpert/foxyXSLTViewer2.htm):

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Firefox XSLT Viewer</title>
<script type="text/javascript">
    function ApplyStylesheet(xmlFile, xslFile) {
         var loadCount = 0;

         var xmlDoc = document.implementation.createDocument("", "", null);
         xmlDoc.addEventListener("load", onload, false);
         xmlDoc.load(xmlFile);

         var xslDoc = document.implementation.createDocument("", "", null);
         xslDoc.addEventListener("load", onload, false);
         xslDoc.load(xslFile);

         function onload(event) {
              alert('onload called');
              if (++loadCount < 2)
                   return;
              var html = null;
              try {
                   var xsltProc = new XSLTProcessor();
                   xsltProc.importStylesheet(xslDoc);
                   var resultDoc = xsltProc.transformToDocument(xmlDoc);
                   var xmlSerial = new XMLSerializer;
                   html = xmlSerial.serializeToString(resultDoc);
              } catch (e) {
                   // Do nothing
              } finally {
                   document.getElementById("result").innerHTML = (html != 
null) ? html : "XSLT Failed!"
              }
         }
    }
</script>
</head>
<body style="font-family:arial; font-size:0.85em;">
     <div style="padding:2px;">XML File <input type="text" size="50" 
id="xmlFile" value="http://treknowledge.com/dmsxpert/test.xml"/></div>
     <div style="padding:2px;">XSL File <input type="text" size="50" 
id="xslFile" value="http://treknowledge.com/dmsxpert/test.xsl"/></div>
     <div style="padding:2px;"><input type="button" value="Apply Stylesheet" 
onclick="javascript:ApplyStylesheet(document.getElementById('xmlFile').value, 
document.getElementById('xslFile').value);"/></div>
     <div 
style="padding:2px;">--- --- --- --- --- --- --- --- --- --- --- --- --- --- 
 --- --- --- --- ---</div>
     <div style="padding:2px;" id="result"></div>
</body>
</html>
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.