web stats
XSL Transform Filter - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2019, 08:38 AM
phatneff phatneff is offline
Mirth Guru
 
Join Date: Jun 2014
Location: Cincinnati, OH
Posts: 179
phatneff is on a distinguished road
Send a message via AIM to phatneff
Default XSL Transform Filter

I'm trying to have an xslt file filter ORU_R01 messages if OBR.25 = "X". I'm struggling to get the syntax correct for it to work properly. I've tried all kinds of different things but the message either doesn't transform or it still gets transformed with OBR.25 = "X". How do I correct this?

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.tibco.com/HL7/CDM/1">
	<xsl:output encoding="UTF-8" indent="yes" />
	<xsl:template match="/">
		<xsl:for-each select="/">
			<xsl:if test="//ns0:MessagePayload/Message/HAPI">
				<xsl:for-each select="//ns0:MessagePayload/Message/HAPI">
					<xsl:for-each select="node()">
						<xsl:if test="starts-with(name(),'ORU_')">
							<xsl:for-each select="//ORU_R01.PATIENT_RESULT/ORU_R01.ORDER_OBSERVATION[OBR/OBR.25!='X']">
								<xsl:copy-of select="." />
							</xsl:for-each>
						</xsl:if>
					</xsl:for-each>
				</xsl:for-each>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>
</xsl:stylesheet>
Reply With Quote
  #2  
Old 08-08-2019, 11:52 PM
schillert schillert is offline
OBX.1 Kenobi
 
Join Date: Jul 2012
Posts: 29
schillert is on a distinguished road
Default

I've only done some xslt processing on the "normal" XML representation of HL7 messages. I start with

Code:
<xsl:template match="/HL7Message">
In order to check for a specific value of a field I do

Code:
<xsl:if test="string(PID/PID.5/PID.5.1/PID.5.1.1/text()) = ''">

I hope this is helpful for you.
Reply With Quote
  #3  
Old 08-09-2019, 03:48 AM
phatneff phatneff is offline
Mirth Guru
 
Join Date: Jun 2014
Location: Cincinnati, OH
Posts: 179
phatneff is on a distinguished road
Send a message via AIM to phatneff
Default

I have this code, which is working, to a point. When the condition is false, it shows an error in the message list, which i don't want.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.tibco.com/HL7/CDM/1">
<xsl:output encoding="UTF-8" indent="yes" />
<xsl:template match="/">
 <xsl:for-each select="/">
  <xsl:if test="//ns0:MessagePayload/Message/HAPI/ORU_R01">
   <xsl:for-each select="//ns0:MessagePayload/Message/HAPI/ORU_R01">
     <xsl:if test="//OBR.25/text() != 'X'">
      <xsl:copy-of select="."/>
     </xsl:if>
   </xsl:for-each>
  </xsl:if>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:40 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation