0

I'm trying to embed this XSL into a CDA Document. This particular document begins something like this:

<?xml version="1.0" encoding="UTF-8"?>
<ClinicalDocument xmlns="urn:hl7-org:v3">
    <realmCode code="US"/>
    <typeId .../>
    ...
    <recordTarget>
        <patientRole>
        ...

Based on this SO question I have tried a couple things, including pasting the XSL within the <ClinicalDocument> element and creating a new root element that contained both the <ClinicalDocument> and the <xsl:stylesheet>. Neither of these worked. From doing some research it looks like I need to modify the XSL to exclude itself perhaps? I haven't had any luck doing this, or modifying the XSL at all as I'm not that familiar with the technology and it's test patterns.

Update Martin's answer is working in Chrome but I'm getting this in IE:

enter image description here

Community
  • 1
  • 1

1 Answers1

1

If you want to embed an xsl:stylesheet and reference it using <?xml-stylesheet type="text/xsl" href="#sheetId"?> then you need

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="#mySheet"?>
<!DOCTYPE ClinicalDocument [
<!ATTLIST xsl:stylesheet
  id    ID  #REQUIRED>
]>
<ClinicalDocument xmlns="urn:hl7-org:v3">
    <xsl:stylesheet id="mySheet" ...>...</xsl:stylesheet>
    <realmCode code="US"/>
    <typeId .../>
    ...
    <recordTarget>
        <patientRole>
    ...
</ClinicalDocument>

The stylesheet is too long for me to check all code but at least the first templates don't make use of any generic path like * which could result in processing the stylesheet elements themselves so the above might suffice.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
  • Chrome just shows a blank page and IE throws `XSLT8690: XSLT processing failed.` Ideas? –  Jul 02 '15 at 18:09
  • Okay, yeah Chrome does work but IE throws that same error. I tried with a different XSLT and had the same results. –  Jul 02 '15 at 18:14
  • I updated the original question with the full IE console output. –  Jul 02 '15 at 18:16
  • I tried a simple test case http://home.arcor.de/martin.honnen/xslt/test2015062601.xml with IE 11 and it seems it does not apply the XSLT and indeed gives that error you have named. I don't know whether IE ever supported that `href="#id"` notation, sorry. Mozilla and Chrome seem to support it, I don't know what do to about IE. – Martin Honnen Jul 02 '15 at 18:17
  • Big sigh. I'll keep looking. I doubt all our customers use Chrome/FF –  Jul 02 '15 at 18:18
  • Does this mean anything to you? http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201108/msg00120.html –  Jul 02 '15 at 18:27