Click to See Complete Forum and Search --> : displaying an xml file in an i-frame


LHayrl
11-26-2003, 12:57 PM
I have a non existing relationship with javascript and need to write a code that will display my xml doument information in an i-frame on an html page. My xml document has the root element <NMOVIE>
<Movie>
<Name></Name>
<Actor_Actress></Actor_Actress>
<Rating></Rating>
<Length></Length>
<Type></Type>
</Movie>

From what I know of i-frames, I know that I have to have a separate htm page for the frame itself. What coding would I put on this page to display my xml info? My xml doc. validates as does my xslt. I want to use the xslt to display the xml info.
Thank you in advance!

TheBearMay
11-26-2003, 01:22 PM
This might work for you:

var xml = new ActiveXObject("MSXML2.DOMDocument.4.0");
xml.async = false;
xml.load("YourFile.xml");
if (xml.parseError.errorCode != 0)
alert('Xml Load Error:'+xml.parseError.reason+' Line: '+xml.parseError.line);

// Load XSL
var xsl = new ActiveXObject("MSXML2.DOMDocument.4.0");
xsl.async = false;
xsl.load("YourFile.xsl");
if (xsl.parseError.errorCode != 0)
alert('Xsl Load Error: '+xsl.parseError.reason+' Line: '+xsl.parseError.line);

// Transform
document.open("text/html","replace");
document.write(xml.transformNode(xsl));

LHayrl
11-26-2003, 01:40 PM
You'r awesome!!!! Thank you!