www.webdeveloper.com
Results 1 to 3 of 3

Thread: displaying an xml file in an i-frame

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Posts
    8

    displaying an xml file in an i-frame

    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!

  2. #2
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    This might work for you:
    PHP Code:
    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)); 

  3. #3
    Join Date
    Nov 2003
    Posts
    8
    You'r awesome!!!! Thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles