Jump to content

H-D

Members
  • Content Count

    4
  • Joined

  • Last visited

Community Reputation

0 Neutral

About H-D

  • Rank
    Newbie
  1. will do. Thanks for your help! hd
  2. Hi, I see the error code now going to script console. When I try to load XML using Javascript in HTML I get the following errors: In IE9:test2.html, line 15 character 13SCRIPT5: Access is denied. Where line 15 is: xhttp.open('GET',dname,false); ----In Chrome I get the following error: XMLHttpRequest cannot load file:///C:/test/cd_catalog.xml. Cross origin requests are only supported for HTTP. test2.html:16 loadXMLDoctest2.html:16 (anonymous function)test2.html:22 Uncaught Error: NETWORK_ERR: XMLHttpRequest Exception 101 test2.html:16 loadXMLDoctest2.html:16 (anonymous function) Thanks,hd
  3. I don’t have to use XSLT. I have also tried to just load the XML in HTML using Javascript and experience the same problem. I have tried IE9 and Google Chrome. I do not get an error. I just don’t see the outputs that I expect. Thanks,hd
  4. Hi, I am new to XSLT and I am trying to load a XML document in XSL so I can manipulate and format the output based on the XML parameter. I am using the example provided by W3schools to load XML but it does not seem to work for. XSL document I am using is attached below I do not see any outputs after the call to “loadXMLDoc()”. If I comment out this line I will see all the outputs.What am I missing? Results with the loadXMLDoc() call:Loading xml file.. Body of html Result with the call commented out:Loading xml file..xml file loaded.. Body of html Thank you for your help in advance. Regards,HD XSL code:===================================================<?xml version="1.0"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <script> function loadXMLDoc(dname) { var xhttp; if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(); return xhttp.responseXML; } var xmlDoc; document.write("Loading xml file..<br/>"); xmlDoc=loadXMLDoc("cd_catalog.xml"); document.write("xml file loaded..<br/>"); </script> <br/> <td>Body of html</td> </body> </html></xsl:template></xsl:stylesheet>================================================================= XML:===================================================<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="../macros/test.xsl"?><CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>Greatest Hits</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD></CATALOG>===============================
×
×
  • Create New...