Written by

Integrations Developer at NHS Tayside
Question Colin Brough · Jan 10

DTL Transformation output: ordering of XML nodes

We are using a DTL transformation to take HL7 and transform into custom XML. But the nodes in the resulting XML are appearing out of sequence - and therefore failing validation against the schema.

The XSD schema for the XML looks fine when imported into Ensemble: root node in the XSD looks like this:

And shows in Ensemble like this:

The transformation looks like this, and we can see the text from the trace elements at lines 5, 12 and 19 appear in the correct order in the event log:

HOWEVER, the resulting XML has the <allergies> nodes before the <patientNotes> nodes....:

Any ideas about why this is happening, and how we can ensure nodes are generated in the correct order?

Product version: Ensemble 2018.1
$ZV: Cache for Windows (x86-64) 2018.1 (Build 184U) Wed Sep 19 2018 09:09:22 EDT

Comments

Colin Brough · Jan 10

Additional info: if we change the order of <allergies> and <patientNotes> in the schema, it does not change the order of elements produced in the XML.

0
Enrico Parisi · Jan 10

Can you provide more details on how the target class used in the DTL is defined?

0
Colin Brough  Jan 10 to Enrico Parisi

Its a virtual document: EnsLib.EDI.XML.Document, with the XML schema applied having been loaded into Ensemble via Ensemble -> InterOperate -> XML -> XML Schema Structures. 

0
Colin Brough · Jan 29

With help from WRC, looks like this is something of our own doing - we were using sub-transforms in ways that caused us problems. Our sub-transforms above were outputting whole new XML documents, when at the very least they should have been taking existing partially produced XML from the top-level transform and using that existing document to output. We "solved" the node ordering issue by moving everything into a single transform, so there was no mismatch between top level and sub-transforms.

0