Hello:
I have been trying to figure out what is wrong with my code given below:
<html>
<title> ESM Menu Display</title>
<head>
<script type = "text/javascript" src = "/zxml.src.
js"> </script>
<script type ="text/javascript">
var req;
function request()
{
req = new XMLHttpRequest();
if (req)
{
alert("object created!");
}
req.onreadystatechange = testState;
req.open("GET","/goform/asim_mainTWO", true);
alert("nothing");
req.send(null);
}
function testState()
{
if(req.readyState==4)
{
changeText();
}
}
function changeText()
{
alert("changeText!");
xmlDom = zXmlDom.createDocument();
if (xmlDom)
{alert("initiating XML DOM");}
xslDom = zXmlDom.createDocument();
if (xmlDom)
{alert("initiating XML DOM");}
xmlDom.async = false;
xslDom.async = false;
alert(req);
xmlDom.loadXML(req.responseText);
if (!xmlDom) {alert("no xml dom");}
alert("loading XSL");
xslDom.load("/menuDisplay.xsl");
alert(xmlDom.xml);
alert(xslDom.xml);
if (xmlDom && xslDom)
{
document.getElementById("div1").innerHTML = zXslt.transformToText(xmlDom, xslDom);
}
}
</script>
</head>
<body onload = "request()">
<div id = "div1"></div>
</body>
</html>
-----------------------------------------------------------
The problem is that I am using goahead webserver and the sample files "menuDisplay.xsl", zxml.src.
js and this HTML file are stored on this webserver's directory. The "goform" calls the "asim_mainTWO" function from where XML data (describing the menu) is written back. (this data is wellformed).
The code shown above executes fully in Internet Explorer and has a correct output. In firefox, it works prefectly untill it hits alert(xslDom.xml). where it just gives a blank alert. In the JAVASCRIPT CONSOLE it shows an error message saying that "this.documentElement" (points to a line in zxml.src.
js) has no properties. Could you please explain why is that so and how should I get around it.
I have been working hard to fix this for about 3 days now but the code seems right. Moreover, please note that the code works fine across all browsers if the files (XML and XSL) are on my local directory.
Thanks,
I appreicate your patience in reading this long email.
Asim