|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
displaying xml with javascript doesn't work in netscape
Hi,
For some reason my xml + xsl isn't showing in netscape (any version). I display the xml with javascript. Here's the page: http://www.aikikai.be/ssk/stages.htm Here's the code <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Stagelijst</title> <link href="StageInfo.css" type="text/css" rel="stylesheet"> <!--<link href="../renshin.css" type="text/css" rel="stylesheet">--> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#B8D0DC"> <center> <b><font color="#CC0000" size="5">Aikido Stage Kalender</font></b> <p>bijgehouden door <a href="http://www.aikikai.be/ssk" target="_parent">Shu Shin Kan</a></p> </center> <div id=XMLStages></div> <script language="JavaScript"> var xmlDoc; var xslDoc; var stagelayer; xmlDoc = new ActiveXObject('Microsoft.XMLDOM'); xmlDoc.async = false; xslDoc = new ActiveXObject('Microsoft.XMLDOM'); xslDoc.async = false; xmlDoc.load("stages.xml"); xslDoc.load("stagesXSL.xml"); if(document.layers){ //thisbrowser="NN4"; stagelayer = document.layers["XMLStages"]; stagelayer.document.open(); stagelayer.document.write(xmlDoc.documentElement.transformNode(xslDoc)); stagelayer.document.close(); } else if(document.all){ //thisbrowser="ie" stagelayer = document.all["XMLStages"]; stagelayer.innerHTML = xmlDoc.documentElement.transformNode(xslDoc); } else if(!document.all && document.getElementById){ //thisbrowser="NN6"; stagelayer = document.getElementById("XMLStages"); stagelayer.innerHTML = xmlDoc.documentElement.transformNode(xslDoc); } </script> </body> </html> Thanks for any and all help ST |
|
#2
|
|||
|
|||
|
Ok, so the reason it's not showing is because Netscape doesn't support ActiveXObject.
So, THE solution is sarissa (http://sarissa.sourceforge.net/). Netscape still isn't showing anything though. Here's the script // get the source document var oDomDoc = Sarissa.getDomDocument(); oDomDoc.async = false; oDomDoc.load("stages/stages.xml"); // get the stylesheet document var oXslDoc = Sarissa.getDomDocument(); oXslDoc.async = false; oXslDoc.load("stages/stagesXSL.xml"); // transform and store the results to a string var sResult = oDomDoc.transformNode(oXslDoc); document.getElementById("XMLStages").innerHTML = sResult; XMLStages is a layer (DIV) Hey Mr wizzard, need a little help please. And don't tell me there is no spoon! ST |
|
#3
|
||||
|
||||
|
I use this bit of script to load an XML doc into Netscape 7+...
Quote:
This page has a nice little sample for when you need to support both IE and Mozilla... http://www.quirksmode.org/dom/importxml.html |
|
#4
|
||||
|
||||
|
Wanna make your life REAL easy? Check this...
http://www.howtocreate.co.uk/jslibs.../importxml.html I'm gonna beat it around a little and see how good it really is. |
|
#5
|
|||
|
|||
|
Thanks!!
This sure helps a lot! ST |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > displaying xml with javascript doesn't work in netscape |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|