<%@ LANGUAGE = JScript %> <% // Parse error formatting function function reportParseError(error) { var s = ""; for (var i=1; i" + "

" + error.reason + "

"; if (error.line > 0) r += "" + "at line " + error.line + ", character " + error.linepos + "\n" + error.srcText + "\n" + s + "^" + ""; return r; } // Runtime error formatting function function reportRuntimeError(exception) { return "XSL Runtime Error" + "

" + exception.description + "

"; } // Set the source and style sheet locations here var sourceFile = Server.MapPath("review.xml"); var styleFile = Server.MapPath("review-bad.xsl"); // Load the XML var source = Server.CreateObject("Microsoft.XMLDOM"); source.async = false; source.load(sourceFile); // Load the XSL var style = Server.CreateObject("Microsoft.XMLDOM"); style.async = false; style.load(styleFile); if (source.parseError.errorCode != 0) result = reportParseError(source.parseError); else { if (style.parseError.errorCode != 0) result = reportParseError(style.parseError); else { try { result = source.transformNode(style); } catch (exception) { result = reportRuntimeError(exception); } } } Response.Write(result); %>