Skip to main content

CDA Documents and XSL Transforms

This chapter provides an introduction to the way InterSystems products handle CDA documents, beginning with an overview of the structure of a CDA document, then describing the library of XSLTs (XSL transformations) that turns CDA documents into SDA, and vice versa.

CDA Document Structure

The root node of all CDA documents is <ClinicalDocument>. Beneath it are three logical divisions: a header, one or more Sections, and one or more Entries within each Section.

  • The header contains metadata, patient demographics, and provider information.

  • A Section establishes a broad concept, such as Allergies or Medication. A Section may contain unstructured, “narrative” data in addition to structured data in the form of Entries.

  • An Entry is embedded within a Section and represents an individual instance within the larger concept. For example, one Entry in the Allergies section might represent a peanut allergy, and another a pollen allergy.

When a CDA document is transformed, Sections and Entries receive transformation instructions from support files, which are discussed in the section “XSLT Directory Structure for CDA Documents”.

All portions of a CDA document conform to templates, which are defined by IHE or some other organization. These templates are identified by OIDs (object identifiers). Templates provide structured, reusable formats for clinical data in a CDA document, and they also indicate the specifications with which a CDA document must comply. Templates can inherit from one another, imposing further constraints. OIDs are made up of strings of integers separated by periods, such as 2.16.840.1.113883. For more information about a specific template, enter its OID into an Internet search engine; there are many online resources that provide detailed OID specifications.

Each Section contains structured and unstructured data. Unstructured data contains items such as text, numbers, and even entire paragraphs; these are located in the narrative portion of a Section. Unstructured data accomplishes two tasks. First, it provides the human-readable section of the CDA required by CDA specifications. Second, unstructured data provides a reference point to which subsequent structured data may refer.

Structured data appears within Sections as Entries. As the name suggests, structured data has more specifications to which it must adhere. Each Entry has one or more templates associated with it, indicating the standards to which that Entry conforms. Entries contain a variety of data, including dates, intervals, strings, and OIDs. Additionally, they contain coded data, and particular fields may expect certain input patterns. A codeSystem attribute, for example, must be a valid OID and cannot be blank.

The following table describes the CCDA v2.1 Sections supported by InterSystems. The left column displays XSLs, while the right column displays their corresponding section names.

XSL CCDA Section Notes
AdvanceDirectives.xsl Advance Directives  
AllergiesAndOtherAdverseReactions.xsl Allergies and Intolerances  
AssessmentAndPlan.xsl Assessment and Plan  
Assessments.xsl Assessment  
ChieftComplaint.xsl Chief Complaint Supported for export only.
ChiefComplaintAndReasonForVisit.xsl Chief Complaint and Reason for Visit Supported for export only.

This XSL defines SDA elements for:

  • Care Plan Type

  • Care Plan Provider

  • Care Plan Support Contacts

  • Care Plan SetId

  • Care Plan Version

  • Care Plan Authors

  • Care Plan Organizations

  • Care Plan Health Concern IDs

  • Care Plan Goal IDs

DiagnosticResults.xsl Results  
DischargeDiagnosis.xsl Discharge Diagnosis  
EncounterDiagnoses.xsl   Used to supplement the default Encounter section specification.
FamilyHistory.xsl Family History  
FunctionalStatus.xsl Functional Status  
Goals.xsl Goals  
HealthConcerns.xsl Health Concerns  
HistoryOfPastIllness.xsl History of Past Illness  
HistoryOfPresentIllness.xsl History of Present Illness  
HospitalAdmissionDiagnosis.xsl Admission Diagnosis  
HospitalCourse.xsl Hospital Course Supported for export only.
HospitalDischargeInstructions.xsl Hospital Discharge Instructions  
HospitalDischargeMedications.xsl Discharge Medications  
Immunizations.xsl Immunizations  
Instructions.xsl Instructions  
Interventions.xsl Interventions  
Medications.xsl Medications  
MedicationsAdministered.xsl Medications Administered  

This XSL defines an SDA element for Care Considerations, including the following sub-fields:

  • Entered By

  • Entered At

  • Entered On

  • External ID

  • Document Time

  • Document Number

  • Document Name

  • Document Type

  • File Type

  • Document Stream

  • Document Status

  • Clinician

  • Custom SDA Data

Outcomes.xsl Health Status Evaluations and Outcomes  
Payers.xsl Payers  
PhysicalExams.xsl Physical Exam Supported for export only.
PlanOfTreatment.xsl Plan of Treatment  
ProblemList.xsl Problem  
ProceduresAndInterventions.xsl Procedures  
ReasonForReferral.xsl Reason for Referral Supported for export only.
ReasonForVisit.xsl Reason for Visit  
SocialHistory.xsl Social History  
VitalSigns.xsl Vital Signs  

XSLT Directory Structure for CDA Documents

InterSystems healthcare products ship with a library of XSLTs to transform CDA documents into SDA, and vice versa.

To view the available root-level XSLTs, navigate to your installation directory and follow the path install-dir\CSP\xslt\SDA3. This directory contains the XSLTs, many of which are named for the actions they perform.

For example, CCDA-to-SDA transforms Consolidated CDA 1.1 CCD into SDA, CCDAv21-to-SDA transforms Consolidated CDA 2.1 CCD into SDA, SDA-to-C32v25 transforms SDA into C32, and so on. These files in turn make calls to other files located in the CDA-Support-Files directory, located at install-dir\CSP\xslt\SDA3\CDA-Support-Files.

Each root-level XSLT (for example, CDA-to-SDA.xsl) begins with xsl:include declarations to pull in the appropriate files located in the CDA-Support-Files directory.

This section describes the various directories within CDA-Support-Files and the functions they serve. As the image indicates, CDA-Support-Files contains the directories:

  • System — Source-controlled, non-configurable files defining widely used items such as OIDs and templates.

  • Site — Configurable files that are used by various XSLTs.

  • Import and Export — Files that are called when transforming CDA into SDA, and vice versa.

  • Reports — Mostly transformations that turn CDA documents into HTML so that they can be displayed in a web browser. This directory is not described below.


XSLTs are cached, so you must restart the production in the applicable namespace after editing a transformation for the changes to take effect.

The System Directory

The System directory contains static files that define a wide range of items. Items in this folder are not configurable.

The directories within System are:

  • Common — Utility templates that are not widely used.

  • OIDs — Variables associated with the OIDs

  • Site-Defaults — A source-controlled version of the Site directory. This directory is not called at runtime. For more information, see “The Site Directory” section.

  • Templates — Variables associated with the template identifiers

The Site Directory

The Site directory contains files that can be uniquely configured.


The files in this directory are not touched upon upgrade in order to preserve customizations. After upgrading, you must manually reconcile these files with the new versions of the files in install-dir\CSP\xslt\SDA3\CDA-Support-Files\System\Site-Defaults, regardless of whether they have been customized. Any files that you did not customize in the Site directory must also be refreshed with the new version in Site-Defaults by manually copying the files into the directory.

The files within Site are:

  • ImportProfile and ExportProfile — Configuration settings that are used during the process of importing and exporting a CDA document into and from your instance. See the “Import Profile” and “Export Profile” sections below.

  • OutputEncoding — An XSLT used on export to control the encoding of the resulting CDA document. The default is UTF-8.

  • Variables — Configurable variables used during import or export. These variables represent organizations and set up “home” information.

Import Profile

The import profile controls configuration settings when importing a CDA document. Almost every variable in the import profile has a <sectionTemplateId>, an <entryTemplateId>, or both; the exception is resultsImportConfiguration, which instead has separate template IDs for <sectionC32TemplateId> and <sectionC37TemplateId>. The presence of a <sectionTemplateId> or an <entryTemplateId> depends on whether the variable in question is found in a section module or an entry module.

Additionally, some variables may contain other settings. The following table lists those settings as well as the variables to which they belong and their values.

Import Profile Settings

Variable Name



generalImportConfiguration/blockImportCTDCodeFromText disabled

Blocks the import of a CDA string, narrative text, or originalText into an SDA CodeTableDetail Code property when the CDA @code attribute is not available.

If this setting is activated and the coded element is nullFlavor, no text is loaded into the SDA Code Property unless the target SDA element is OrderItem and the orderItemDefaultCode or orderItemDefaultDescription configuration parameter is turned on.

If blockImportCTDCodeFromText is not enabled, the import behavior remains unchanged from the previous version.



Indicates whether or not SDA action codes are enabled. SDA action codes control the update and deletion of data.



Indicates whether CDA <id> elements should be used to import SDA ExternalId property values where applicable.



When enabled, and a CDA Result cannot be classified as an SDA LabOrder or RadOrder, then the Result is imported as an SDA OtherOrder. Otherwise the Result is not imported.



When the value equals 1, if hl7:representedOrganization/hl7:id @root is an OID and @extension is numeric, then both are concatenated into one facility OID.



A value of 1 imports the narrative section as text, importing both <br/> and narrative line feeds as line feeds. A value of 2 imports as text, using only <br/> as a line feed. This applies only to the import of Result Text, Hospital Discharge Instructions, and Reason for Visit.





Indicates the status of a medication. Its value depends on the variable in which it is located, which in turn indicates the CDA section from which the medication is being imported.

planImportConfiguration effectiveTimeCenter

When set to 0: effectiveTime/center values will be imported to FromTime.

When set to 1 :effectiveTime/center values will be imported to FromTime and ToTime.

Note: If effectiveTime/center is populated for a particular care plan, effectiveTime/high and effectiveTime/low should not be populated for that care plan.



Helps to select the correct hl7:organizer within a given results entry when there is more than one. One alternate value it might be given is $ihe-PCC-LabBatteryOrganizer.



Code to use for SDA OrderItem Code when a CDA Result does not include information from which to derive an OrderItem Code or Description.



Description to use for SDA OrderItem Code when a CDA Result does not include information from which to derive SDA OrderItem Code or Description.



A value of 1 means that this setting is enabled. This is the default. The system adds a Health Fund streamlet for each Encounter to the resulting SDA.



A value of 0 means that this setting is disabled. The system will not create a Health Fund streamlet for every Encounter.



A value of 1 means that this setting is enabled. For each Payor received in the CCD/CCDA, the system will create a Member Enrollment streamlet in the resulting SDA.



A value of 0 means that this setting is disabled. This is the default. The system will not create a Member Enrollment streamlet in the resulting SDA.

Export Profile

Most elements in the export profile have an <emptySection> element, a <narrativeLinkPrefixes> element, or both. <emptySection> elements control whether or not to export a section that contains no information. <narrativeLinkPrefixes> allow you to enter text to be included in the narrative, or human-readable, portion of a CDA document.

Additionally, some sections may contain other settings. These settings can be edited and augmented depending on the data that is to be exported. The following table lists those unique settings as well as the sections in which they are found and their values.

Export Profile Settings






Codes that can be used as additional diagnosis types for admission.



Codes that correspond to various advance directive types, such as resuscitation or intubation.



Codes that can be used as additional diagnosis types for assessment.



Codes that can be used as additional diagnosis types for discharge.

encounterDiagnoses/exportToC32 disabled If enabled (value = 1), allows the export of encounter diagnoses to CDA C32.



Controls whether or not to include historical medications in the current medications list.



Limits how old in days a medication can be and still be included in the current medications list.



Hides the narrative column.

planOfCare effectiveTimeCenter

When set to 0: FromTime will be exported to effectiveTime/low and ToTime will be exported to effectiveTime/high.

When set to 1: IF FromTime and ToTime have the same non-null value, that value is exported to effectiveTime/center. ELSE: if FromTime has a value, it is exported to effectiveTime/low. If ToTime has a value it is exported to effectiveTime/high. EXCEPTION: if ProcedureTime has a value, it is exported to effectiveTime/Center in place of FromTime.



Codes that correspond to various problem types, such as ACTIVE or CHRONIC.



Limits how old in days a medication can be and still be included in the current problems list.



Indicates whether or not to export smokingStatus when it contains no data.

The Import and Export Directories

The Import and Export directories contain files that are called when XSLTs transform data.

  • The Import directory contains those files that are called when transforming CDA into SDA.

  • The Export directory contains those files that are called when transforming SDA into CDA.

Both the Import and the Export directories contain subdirectories labeled Common, Entry-Modules, and Section-Modules.

  • The Common directory contains XSLTs that set up commonly used global variables for the various transformations and provide templates that contain commonly used logic, such as address-Home.

  • The Section-Modules directory contains XSLTs that transform data to or from a given CDA section; the name of each XSLT corresponds closely to the name of the CDA section it transforms.

  • The Entry-Modules directory contains XSLTs that map the transformation into the correct Entry of a document and then parse the coded data. As a result, XSLTs within this directory tend to be significantly longer than their counterparts in the Section-Modules directory.

Each root-level XSLT (for example, CDA-to-SDA.xsl) begins with xsl:include declarations to pull in the appropriate Section-Modules, Entry-Modules, and Common files, as well as other necessary files.

FeedbackOpens in a new tab