XSLT transformation error in IE
MSXML's parser is crashing on load with error:
Reference to undefined entity 'commat'.
@ references the popular '@' symbol.
Following the normal XML parser directive (<?xml...), the xsl document defines a local dtd, where the entity reference is explicitly defined:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY amp "&#38;">
<!ENTITY quote "&#34;">
<!ENTITY apos "&#39;">
<!ENTITY lpar "&#40;">
<!ENTITY rpar "&#41;">
<!ENTITY plus "&#43;">
<!ENTITY gt "&#62;">
<!ENTITY commat "&#64;">
<!ENTITY verbar "&#124;">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
The transformation succeeds outside of the browser (e.g. xalan).
Note that posting the entirety is quite impractical, as the xml file is well over 15KB, and the XSL file contains over 1000 lines on its own, plus multiple imports.
The code uses "msxml2.DOMDocument.6.0", and the doc object is set with:
xslDoc.async = false;
xslDoc.resolveExternals = true;
xslDoc.validateOnParse = false;
Microsoft Support(MSS) Resolution
The original XHTML, XML and XSLT are all valid, and meet w3's recommendation. Xalan and others parse it successfully, yet Firefox is the only browser that does so with minor modifications.
MSS resolution included a number of directives:
1. The Doctype declaration at the top of the XML source file had to be removed.
2. Entity references are not permitted - replace them with numeric references.
3. The XHTML file MUST contain a doctype.
4. All @Import files referenced within XML and XSLT files must contain fully qualified paths, not relative paths, to the server on which they reside.
5. When processing the IE transformation, be aware that IE v.9+ supports document.implementation and document.implementation.createDocument, so either use
if (typeof ActiveXObject != "undefined") or include a meta tag that informs your IEv9+ browser to process the document using v8:
<meta http-equiv="X-UA-Compatible" content="IE=8" >
The subject of cross-browser XSLT transformations remains challenging, and a working solution would be the subject of a great book; I would be very interested in procuring such a book if/when it ever gets published.
Although the resolution does not meet all of my expectations it does appear to offer a working option for the current solution.