XSL Transform device
The XSL Transform device uses an XSLT to transform an XML document into an HL7 message.
Viewing the XSLT Code
The middle panel contains the code used in the selected XSLT. This code maps elements in the XML to segments in the HL7 message schema. It also defines the XML namespace for the XSL stylesheet.
Code the XSLT directly in this panel. At the top is a toolbar with several button options:
- Find elements within the XSL
- Comment out any lines that have been selected within the XSL. Lines that have been commented out will not be executed when the device runs.
- Uncomment selected lines that were previously commented out. Uncommenting lines means they will be executed when the device runs.
- Collapse to definitions: Click this button to collapse all of the lines of code to simply the definitions, which hides the processing details (such as XML to HL7 mappings). Lines that will can be expanded or collapsed are indicated with a + or a - icon at the beginning of the line.
Using Transforms
The Transform is the container that holds the code that will tell the device how to manipulate the incoming XML file. A device can be associated with multiple transforms, although only one can be used at a time.
'
Select the check box in the Use column for the transform you want the device to use. Select the transform row to load the code for viewing or editing.
The Simple transform is included with the device and is used by default. The code associated with this transform can be modified to meet your requirements.
To add a new transform:
- Click the "add transform" button.
- A row labeled New XSLT will appear. Double-click on the name to edit and call your transform something more meaningful.
- Select this transform. No code will be associated with it yet; you can write code in the middle panel
- Save the changes to the device.
To remove a transform:
- Select the row for the transform you want to delete.
- Click the "remove transform" button (the red circle with the "x").
- Confirm the removal on the resulting pop-up message.
- Save the changes to the device.
Using Namespaces
Because of the nature of XML, different elements can be used for different purposes across software modules. To define an element's purpose for a module, you must use a namespace. This namespace is declared in the XSLT:
You also list the URI for the namespace in the Namespaces panel for the device.
Multiple namespaces can be listed.
To add a namespace:
- Click the "add namespace" button.
- An empty row will be inserted in the list. Double-click in the Prefix column to specify the prefix. This is the same as the prefix before the namespace that is in the XSLT.
- Double-click in the Namespace Uri column to set the URI for the namespace.
- Save the device.
To remove a namespace:
- Select the row for the namespace you want to delete.
- Click the "remove namespace" button (the red circle with the "x").
- Confirm the removal on the resulting pop-up message.
- Save the changes to the device.
Previewing messages
Once the device is configured, you can preview the XML conversion to make sure it is accurate - as long as there are messages in the queue.
To preview the message conversion:
- Load messages into the queue.
- Select the XSL Transform device.
- Select a message in the Inbound Message pane. The conversion results will be shown in the Outbound Message pane.
If the conversion is correct, you can unpause any devices/channels and continue processing. If it is incorrect, edit the device as needed and preview the message conversion again. Any errors will be shown in the Outbound Message pane; click the arrow to expand the error for additional details.