CDA to CDA transformation
Hi Community,
I am new to CDA to CDA transformation in ensemble, Can anyone explain how Match,Select,Varibel,Attribute,Copy,Method Will work in CDA transformation using xslt stylesheets
Smythee
Comments
In InterSystems CDA XSLT work, the documents returned here explain these items mainly through examples of custom and preprocessing transforms.
-
matchis used onxsl:templateto define which node a template applies to. Examples shown include matching the root CDA document, any node, text nodes, or a very specificeffectiveTimepath, such as: -
selectis used to choose nodes or values for processing. The examples show it being used with:xsl:apply-templates select="@*"to process attributesxsl:apply-templates select="node()"to process child nodesxsl:copy-of select="@*"to copy attributesxsl:value-of select="hl7:low/@value"to extract an attribute valuexsl:variable name="input" select="/hl7:ClinicalDocument"orselect="exsl:node-set($inputRTF)/hl7:ClinicalDocument"to define variables from node selections. [1][4][2]
-
variableis used to store intermediate results. The preprocessing example shows replacing a direct input variable with: -
attributeis used to work with XML attributes. The examples show:- selecting attributes with
@* - copying attributes with
xsl:copy-of select="@*" - reading an attribute such as
hl7:low/@value - creating an attribute using:
<xsl:attribute name="value"> <xsl:value-of select="hl7:low/@value"/> </xsl:attribute> - debugging a CDA attribute value with
select="/hl7:ClinicalDocument/hl7:id/@root". [1][2]
- selecting attributes with
-
copyis used to reproduce nodes. The preprocessing template shows: -
modeis important in InterSystems CDA customization. The preprocessing examples use a custom mode such asmo:MyMODEnameso that special preprocessing templates are called separately from the main transform. The top-level transform is then modified to call:<xsl:apply-templates select="/hl7:ClinicalDocument" mode="mo:MyMODEname"/>This lets you run a preprocessing pass before the standard transform uses the resulting document. The customization guide also shows other modes such as
ImportCustom-Container,ImportCustom-Procedure,currentXPathWithPos,currentXPath, andcopy. [1][4][2] -
For custom CDA transformations in general, the documented pattern is:
- create a
Customsubdirectory, - create a custom XSL with the same name,
- import the original XSL with
<xsl:import href="../<filename>"/>, - copy the template you want to override,
- change its logic,
- restart productions to activate it. [2]
- create a
-
For CDA structure, the returned material also notes that the root node is
<ClinicalDocument>, with header, sections, and entries beneath it, and transformations for sections and entries are driven by support files. That helps explain why templatematchexpressions often target specific CDA paths. [3]
Important: If you plan to customize transformations and InterSystems IRIS for Health is running in a Docker container, the container must point to a durable directory. For more information on durable directories, see Running InterSystems Products in Containers. [2]
If you want, I can next turn this into a small CDA XSLT example showing each of match, select, variable, attribute, copy, and mode in one sample transform.
Sources: