tinwatchman Posted June 11, 2009 Report Share Posted June 11, 2009 (edited) Hello -So I'm trying to use a modified version of the script example provided here - http://www.w3schools.com/xsl/xsl_client.asp - on a page I'm working on. When I try to test it on IE7, though, I get the following error: "The stylesheet does not contain a document element. The stylesheet may be empty, or it may not be a well-formed XML document." Not sure what's going on here. It sounds like there's something wrong with the way my XSL stylesheet is formatted? ... Here's a link to the XSL stylesheet and the XML I'm using it to style:...... Anyone run into this problem themselves? Any suggestions?edit: went back and deleted links to avoid search engine indexing of my test server. Solution I found is below. Edited June 11, 2009 by tinwatchman Link to comment Share on other sites More sharing options...
tinwatchman Posted June 11, 2009 Author Report Share Posted June 11, 2009 Okay, never mind. I think I got it. Looks like Microsoft's XML parser was going screwy for some reason. Here's what I added, in case anyone ever runs into the same problem: function loadXMLDoc(filename) { var xmlDoc; if (window.ActiveXObject) { // IE code xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); [color="#FF0000"]xmlDoc.validateOnParse = false;[/color] } else if (document.implementation && document.implementation.createDocument) { // code for Mozilla and everyone else xmlDoc = document.implementation.createDocument("","",null); } else { alert("LoadXMLDoc nonfunctional in this browser!"); } xmlDoc.async = false; xmlDoc.load(filename); return xmlDoc;} The line in red takes the parser from throwing out errors if it doesn't validate for some reason. Hope this helps someone. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now