HL7 / CDA-core-xsl

Informative stylesheet based on XSLT 1.0 to render all CDA documents
35 stars 20 forks source link

CDA R2 Stylesheet

Quick Links: Manual - Localization - Parameters - Wiki - Release Notes - Security Notes

Introduction

The CDA Release 2.0 publication comes with an informative stylesheet based on XSLT 1.0. The stylesheet is maintained under responsibility of the Structured Documents Workgroup. Publications are under releases The intent of the stylesheet is to offer an example of how to render a CDA document. It does this by rendering XHTML 1.0 Strict with the following information:

 <?xml-stylesheet type="text/xsl" href="https://github.com/HL7/CDA-core-xsl/blob/master/CDA.xsl"?>

or with an absolute path:

 <?xml-stylesheet type="text/xsl" href="http://example.org/cda/CDA.xsl"?>

The web browser needs to be able to access the relative or absolute location of the stylesheet. For security reasons, you probably want that location to be inside your own environment.  Although the stylesheet supports many parameters, these are not configurable from a browser. If you need a different value for a stylesheet parameter than the default you can either update the default in the stylesheet, or run the stylesheet programmatically e.g. using Saxon-PE. If you update the defaults in the stylesheet, you might have a harder time updating the stylesheet if the base receives updates that you want in your environment too. Running the stylesheet programmatically could be done in any environment that supports XSLT 1.0. The major implementations of XSLT are Saxon, libxslt and Xalan. Example command line call for Saxon where the parameter for rendering the header is set to false could be:

java -jar ../lib/saxon-9/saxon9.jar -s:cda-example.xml -xsl:CDA.xsl -o:cda-example.html dohtmlheader=false mask-ids=2.16.840.1.113883.4.1

What this says:

 <language description="Dutch (Netherlands)" lang="nl-nl"/>

Adding a new string to an existing translation element

Add new strings to existing translation elements as needed. If the en-US term is sufficient for your language too: you do not need to list it in the language file. Add a line like this in the appropriate translation element:

 <value lang="nl-nl">Patiënt</value>

Note that the value for attribute lang needs to exist in the listing of languages at the top of the file.

Adding a new translation element

This is only relevant when certain vocabulary or a certain identifier OID is inadvertently not supported. Other strings could only occur if you are updating the stylesheet itself. Add a translation element like this:

 <translation key="myKey">
   <comment>Label: my comment in free text</comment>
   <value lang="en-us">Patient</value>
   <value lang="nl-nl">Patiënt</value>
 </translation>

Make sure that you have en-US covered at the very least. Other languages as you see fit.

Parameters

The stylesheet supports many ways to parametrize.