Written by

Question Adam Marsh · Aug 5, 2020

Converting XLT (XML) into DTL (XML)

Greeting IRIS Community,

I need some help converting XLT (XML) into DTL (XML) pragmatically using COS or any other available options in IRIS for health.
It is for HL7-TO-nonHL7 translation. 

See the following xlt content as an example that i have in XML Format.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../server/stylesheet/xltconfig.xsl"?>
<xltconfig name="accenture-1.xlt" site="thac">
<input>
<description>HL7 2.2/2.2 ADT_A16</description>
<href>thmaster/formats/hl7/2.2/22/index.xml</href>
</input>
<output>
<description>pendingDischarge.vrl</description>
<href>thmaster/formats/variable/ADT_Pending.vrl.xml</href>
</output>
<actions>
<action op="CONCAT" level="1" icon="CONCAT.gif" activated="true">
<pre></pre>
<post></post>
<in>=&apos; 0(0).MSH(0).#10(0).[0] =&apos;</in>
<out>PROPERTY1</out>
<err handling="0" description="Skip"/>
<default></default>
<separator></separator>
</action>
<action op="CONCAT" level="1" icon="CONCAT.gif" activated="true">
<pre></pre>
<post></post>
<in>=&apos; 0(0).MSH(0).#9(0).[0] =_ 0(0).EVN(0).#1(0).[0] =&apos;</in>
<out>PROPERTY2</out>
<err handling="0" description="Skip"/>
<default></default>
<separator></separator>
</action>
<action op="CONCAT" level="1" icon="CONCAT.gif" activated="true">
<pre></pre>
<post></post>
<in>0(0).MSH(0).#4(0).[0] 0(0).PV1(0).#2(0).[0]</in>
<out>PROPERTY3</out>
<err handling="0" description="Skip"/>
<default></default>
<separator></separator>
</action>
...
......
.......
.........

Expected Results in DTL 
Expected conversion should be like this in DTL (XML) format.

DTL <?xml version="1.0" encoding="UTF-8"?> <Export ts="2020-01-09 01:01:00" zv="IRIS for Windows (x86-64) 2020.1 (Build 217_1U)" version="26" generator="IRIS">
<Class name="Mypackage.Myclass"> <Super>Ens.DataTransformDTL</Super> <TimeChanged>62323,43489.390656</TimeChanged> <TimeCreated>62323,42706.863977</TimeCreated> <DependsOn>EnsLib.HL7.Message,MyRecordMap.test</DependsOn>
<Parameter name="IGNOREMISSINGSOURCE"> <Default>1</Default> </Parameter>
<Parameter name="REPORTERRORS"> <Default>1</Default> </Parameter>
<Default>0</Default> </Parameter>
<XData name="DTL"> <XMLNamespace>http://www.intersystems.com/dtl</XMLNamespace&gt;
<Data> <![CDATA[
<transform sourceClass='EnsLib.HL7.Message' targetClass='MyRecordMap.test' sourceDocType='2.2:ADT_A16' create='new' language='objectscript' >
<assign value='source.{MSH:MessageControlID}' property='target.PROPERTY1' action='set' />
<assign value='source.{MSH:RecevingFaciltyID}' property='target.PROPERTY2' action='set' />
<assign value='source.{MSH:SendingFacilityID}' property='target.PROPERTY3' action='set' />
.....
........
..........
The above content is just an example.
All the <action> tag from VRL XML should be converted to <assign> tag in DTL XML.

any help in this matter would be really appreciated.

Thanks in Advance!!

Comments

Marc Mundt · Aug 6, 2020

Since both formats are XML-based, you could write an XSLT to do the conversion. To further automate the process you could create COS that calls the XSLT, creates a new DTL file and inserts the rules into the XData block, and compile the new DTL.

0
Adam Marsh  Aug 6, 2020 to Marc Mundt

Hi Marc,

your suggestion is very much appreciated.

Do you have any working example that you can share with me
OR
share a code snippet for converting XLT XML to XSLT.
OR
Share COS code snippet at very high level just an example.

Adam

0
Adam Marsh  Aug 10, 2020 to Adam Marsh

Hi @Marc Mundt ,

Do you have any example to convert XML into XSLT and then use it in COS?

Thanks

Adam

0