Search code examples
xmlxsltinternet-explorer-9stylesheet

Style sheet for XML not rendering in IE9


I have a xml document which right now is not even recognized as xml on IE9. I have tried adding correct xmlns:xsl attribute, also it has a correct header starting with

<?xml version="1.0" encoding="UTF-8"?>

This xml renders perfectly in IE 6 7 8 but does not work in IE9. I am not sure if it is Quirks mode related issue, and if it is I am not sure what DOCTYPE is should use for XML documents. Any help will be greatly appreciated. Following is the first few lines of XML document.

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/mobiledoc/jsp/empi/master/CCD.xsl" ?>
<ClinicalDocument xmlns="urn:hl7-org:v3" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                  xmlns:sdtc="urn:hl7-org:sdtc" 
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xsi:schemaLocation="urn:hl7-org:v3 http://xreg2.nist.gov:8080/hitspValidation/schema/cdar2c32/infrastructure/cda/C32_CDA.xsd" 
                  classCode="DOCCLIN" 
                  moodCode="EVN">

Solution

  • Can you be more specific as to how it's "is not even recognized as xml on IE9"? Do you get an error message, or is it simply that it looks different in IE9 than in previous versions?

    The first thing your XML file does is associate itself with an XSLT stylesheet at "/mobiledoc/jsp/empi/master/CCD.xsl" so this could be the source of your problem. Some suggestions:

    • As a test, remove the <?xml-stylesheet .. ?> bit. Do you now get the same behaviour in all browsers? (Probably just a hierarchical view of the XML file) If so, then the problem is in your XSLT stylesheet.

    • What does that stylesheet do? If it's converting the XML file into HTML, it might be using some non-conformant (X)HTML constructs or styles which older versions of IE tolerated, but which IE9 is more strict about. If the "not recognized" is some layout/display issue, tweaking the stylesheet might fix what you see in the browser.

    Based on what you've told us so far, I think that's probably where you need to start.

    ETA: The upshot of the conversation below was that the <xsl:output> directive was forcing a 4.01 HTML doctype into the output; changing this to <xsl:output method="html"/> (and fixing a couple of other issues with the transform) fixed the problem in IE9.