Jump to content

Problem With Example In Xslt Tutorial


tinwatchman

Recommended Posts

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.

Link to comment
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...