After mulling over how to best implement HL7 interfaces, after reading Microsoft’s partner recommendations; having been involved in a HL7 implementations myself and (via this blog) assisted many people with their companies HL7 implementation. Since Microsoft hasn’t ever asked me to write for them, I would like to offer some of the best practices that I have found that greatly reduce the amount of time it takes to bring up a HL7 implementation using BizTalk.

Please let me know if you have other items that assist.

Here are the things I have written about:
Create custom schemas for each data source
Optional Z Segment enhancements
MSH Segment Modifications
Context Properties of the HL7 Message
HL7 Mapping
Summary

Create custom schemas for each data source

I know that this seems logical, but I have come across a few companies that have not bothered to implement this, and simply have taken the out of the box schemas that Microsoft has delivered and ’expanded’ or otherwise tweaked it to accept every data source’s definition. To do this is pretty easy. The steps are as follows:

Set up the Partner1 HL7 version project

Open up all of the schemas in a text editor and replace the default target namespace with the partner’s value.

So lets now set up the project that will actually define the messages received or created, and reference both the Common project you just created and the 2XCommon (to be explained later)

Now let’s create the message we are going to be receiving

Now we are able to make customizations

Now we can do the same thing for a second data source.

And the replace

The referencing of the parent projects and the creation of the message

And now the target namespace replacement

And the subsequent customizations to this feed

Okay, now we need to define to BizTalk, how it is going to know which set of schemas to use

Create the Party names and then open up the BTAHL7 Configuration Explorer

In the BTAHL7 Configuration Explorer, we define the target namespace.

Optional Z Segment enhancements

According to the documentation, to deal with Z segments, you create as part of your multipart HL7 message a System.String message part.

A better approach it to define a schema and use it as a Z Segment.

Since I might use this schema for every trading partner, I have added it to the 2XCommon project.

In an orchestration, we create the multi-part message.

When you create the multipart message, make sure that you first create the BodySegments first and then add the other parts (an error occurs when the orchestration attempts to pair up the body parts to the intended parts if it is not done correctly).

(Click to expand)

If you had followed even the latest ’recommendations from the msdn’ by setting the Z Segments as a string, you can’t access the message parts directly, and would have to use a message assignment block to ’extract’ the segments you want and then map what you want. (Bad practice if you ask me).

MSH Segment Modifications

I have seen this come up a few times, and I have asked the question once myself, so I might as well put it here:

You can’t have multiple MSH segments deployed, the HL7 DASM/ASM is looking for the MSH segment that comes pre packaged with the product.

The question then arises, what if I have different looking MSH segments coming in from different trading partners?

The answer is to either modify the single MSH segment schema to handle all types of MSH segments, or to place a pre processing component in front of the HL7 DASM to allow it to conform to the out-of-the-box MSH schema.

Context Properties of the HL7 Message

This really isn’t a best practice, but just an less than explicitly documented feature that I thought would be worth noting.

After you have created your outbound HL7 message, there are some properties that you need to assign.

// decimal representation of the MSH1
ORU_R01Msg(BTAHL7Schemas.MSH1) = 124; 
// characters representative of MSH2
ORU_R01Msg(BTAHL7Schemas.MSH2) = "^~\\&";
// defined so the BTAHL7 ASM does not handle it incorrectly
ORU_R01Msg(BTAHL7Schemas.ParseError) = false; 
// Do not include the Z Segment in the final output
ORU_R01Msg(BTAHL7Schemas.ZPartPresent) = false;
// append a <LF> to the segment seperator (normally just a <CR>)
ORU_R01Msg(BTAHL7Schemas.SegmentDelimiter2Char) = true;

HL7 Mapping

According to the HL7 v2 Developers guide located in BizTalk Server 2006 R2 documentation on msdn, down near the end, there is a section called Controlling the Order of Mapped elements, it states you should simply be able to write some customize XSLT to accomplish the mapping necessary.

The example they provide is this:

<Sorted_Input>
 <A><one/></A>
 <B><two/></B>
 <A><one/></A>
 <B><two/></B>
</Sorted_Input>

The output, if you simply use the mapper creates the following output:

<Bad_Output>
 <A><one/></A>
 <A><one/></A>
 <B><two/></B>
 <B><two/></B>
</Bad_Output>

The answer is to simply modify the XSLT to use a for-each statement and it will solve it:

<xsl:for-each select="Sorted_Input">
    <Bad_Output>
        <xsl:for-each select="A">
            <A><one><xsl:value-of select="one"/></one></A>
        </xsl:for-each>
        <xsl:for-each select="B">
            <B><two><xsl:value-of select="two"/></two></B>
        </xsl:for-each>
    </Bad_Output>
</xsl:for-each>

Which creates the output:

<Good_Output>
 <A><one/></A>
 <B><two/></B>
 <A><one/></A>
 <B><two/></B>
</Good_Output>

When I read through this, I thought, that is too easy and it is not right. I have never seen any HL7 message come in that looks that simple!

I must be the only one that has come across this issue because no one has ever complained about it, or asked. but I have always had a hard time mapping the HL7 schemas to something a little more understandable.

Here is the input schema to the ORU_R01

Which means that the xml document shows up in the message box looking like this:

Notice that the simple for-each situation will not work in this situation. Here are the problems I see:

The ORC_CommonOrderSegment OR the OBR_ObservationRequestSegment represent a new ’Order’

The OBX_CobersationResultSegment can have a NTE_NotesAndCommentsSegment_2

I simply wanted to create the same input as output, except ’levelled’ so I can map it to a different structure.

Here is the schema I created:

Instead of explaining how to map it successfully, here is the xslt to do this transformation

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
xmlns:ns0="http://labcorp.com/HL7/2X">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="/ns0:ORU_R01_231_GLO_DEF">
    <ns0:ORU_R01_231_GLO_DEF>
      <CompleteOrder>
        <Patient>
          <xsl:for-each select="PID_PatientIdentificationSegment">
            <PID_PatientIdentificationSegment>
              <PID_1_SetIdPid>
                <xsl:apply-templates select="PID_1_SetIdPid"/>
              </PID_1_SetIdPid>
              <PID_2_PatientId>
                <CX_0_Id>
                  <xsl:value-of select="PID_2_PatientId/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_2_PatientId>
              <PID_3_PatientIdentifierList>
                <CX_0_Id>
                  <xsl:value-of select="PID_3_PatientIdentifierList/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_3_PatientIdentifierList>
              <PID_4_AlternatePatientIdPid>
                <CX_0_Id>
                  <xsl:value-of select="PID_4_PatientIdentifierList/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_4_AlternatePatientIdPid>
              <PID_5_PatientName>
                <XPN_0_FamilyLastName>
                  <XPN_0_0_FamilyName>
                    <xsl:value-of  select="PID_5_PatientName/XPN_0_FamilyLastName/XPN_0_0_FamilyName"></xsl:value-of>
                  </XPN_0_0_FamilyName>
                </XPN_0_FamilyLastName>
                <XPN_1_GivenName>
                  <xsl:value-of select="PID_5_PatientName/XPN_1_GivenName"></xsl:value-of>
                </XPN_1_GivenName>
                <XPN_2_MiddleInitialOrName>
                  <xsl:value-of select="PID_5_PatientName/XPN_2_MiddleInitialOrName"></xsl:value-of>
                </XPN_2_MiddleInitialOrName>
              </PID_5_PatientName>
              <PID_6_MotherSMaidenName>
                <XPN_0_FamilyLastName>
                  <XPN_0_0_FamilyName>
                    <xsl:value-of select="PID_6_MotherSMaidenName/XPN_0_FamilyLastName/XPN_0_0_FamilyName"></xsl:value-of>
                  </XPN_0_0_FamilyName>
                </XPN_0_FamilyLastName>
              </PID_6_MotherSMaidenName>
              <PID_7_DateTimeOfBirth>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="PID_7_DateTimeOfBirth/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </PID_7_DateTimeOfBirth>
              <PID_8_Sex>
                <xsl:value-of select="PID_8_Sex"></xsl:value-of>
              </PID_8_Sex>
              <PID_9_PatientAlias>
                <XPN_0_FamilyLastName>
                  <XPN_0_0_FamilyName>
                    <xsl:value-of select="PID_9_PatientAlias/XPN_0_FamilyLastName/XPN_0_0_FamilyName"></xsl:value-of>
                  </XPN_0_0_FamilyName>
                </XPN_0_FamilyLastName>
              </PID_9_PatientAlias>
              <PID_10_Race>
                <CE_5_NameOfAlternateCodingSystem>
                  <xsl:value-of select="PID_10_Race/CE_0005_0_Identifier"></xsl:value-of>
                </CE_5_NameOfAlternateCodingSystem>
              </PID_10_Race>
              <PID_11_PatientAddress>
                <XAD_0_StreetAddress>
                  <xsl:value-of select="PID_11_PatientAddress/XAD_0_StreetAddress"></xsl:value-of>
                </XAD_0_StreetAddress>
              </PID_11_PatientAddress>
              <PID_12_CountyCode>
                <xsl:value-of select="PID_12_CountyCode"></xsl:value-of>
              </PID_12_CountyCode>
              <PID_13_PhoneNumberHome>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="PID_13_PhoneNumberHome/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </PID_13_PhoneNumberHome>
              <PID_14_PhoneNumberBusiness>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="PID_14_PhoneNumberBusiness/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </PID_14_PhoneNumberBusiness>
              <PID_15_PrimaryLanguage>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_15_PrimaryLanguage/CE_0296_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_15_PrimaryLanguage>
              <PID_16_MaritalStatus>
                <CE_2_NameOfCodingSystem>
                  <xsl:value-of select="PID_16_MaritalStatus/CE_0002_0_Identifier"></xsl:value-of>
                </CE_2_NameOfCodingSystem>
              </PID_16_MaritalStatus>
              <PID_17_Religion>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_17_Religion/CE_0006_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_17_Religion>
              <PID_18_PatientAccountNumber>
                <CX_0_Id>
                  <xsl:value-of select="PID_18_PatientAccountNumber/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_18_PatientAccountNumber>
              <PID_19_SsnNumberPatient>
                <xsl:value-of select="PID_19_SsnNumberPatient"></xsl:value-of>
              </PID_19_SsnNumberPatient>
              <PID_20_DriverSLicenseNumberPatient>
                <DLN_0_DriverSLicenseNumber>
                  <xsl:value-of select="PID_20_DriverSLicenseNumberPatient/DLN_0_DriverSLicenseNumber"></xsl:value-of>
                </DLN_0_DriverSLicenseNumber>
              </PID_20_DriverSLicenseNumberPatient>
              <PID_21_MotherSIdentifier>
                <CX_0_Id>
                  <xsl:value-of select="PID_21_MotherSIdentifier/CX_0_Id"></xsl:value-of>
                </CX_0_Id>
              </PID_21_MotherSIdentifier>
              <PID_22_EthnicGroup>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_22_EthnicGroup/CE_0189_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_22_EthnicGroup>
              <PID_23_BirthPlace>
                <xsl:value-of select="PID_23_BirthPlace"></xsl:value-of>
              </PID_23_BirthPlace>
              <PID_24_MultipleBirthIndicator>
                <xsl:value-of select="PID_24_MultipleBirthIndicator"></xsl:value-of>
              </PID_24_MultipleBirthIndicator>
              <PID_25_BirthOrder>
                <xsl:value-of select="PID_25_BirthOrder"></xsl:value-of>
              </PID_25_BirthOrder>
              <PID_26_Citizenship>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_26_Citizenship/CE_0171_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_26_Citizenship>
              <PID_27_VeteransMilitaryStatus>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_27_VeteransMilitaryStatus/CE_0172_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_27_VeteransMilitaryStatus>
              <PID_28_Nationality>
                <CE_0_Identifier>
                  <xsl:value-of select="PID_28_Nationality/CE_0212_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </PID_28_Nationality>
              <PID_29_PatientDeathDateAndTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="PID_29_PatientDeathDateAndTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </PID_29_PatientDeathDateAndTime>
            </PID_PatientIdentificationSegment>
          </xsl:for-each>
          <Visit>
            <PV1_PatientVisitSegment>
              <xsl:for-each select="PV1_PatientVisitSegment">
                <PV1_1_SetIdPv1>
                  <xsl:value-of select="PV1_1_SetIdPv1"></xsl:value-of>
                </PV1_1_SetIdPv1>
                <PV1_2_PatientClass>
                  <xsl:value-of select="PV1_2_PatientClass"></xsl:value-of>
                </PV1_2_PatientClass>
                <PV1_3_AssignedPatientLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_3_AssignedPatientLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_3_AssignedPatientLocation>
                <PV1_4_AdmissionType>
                  <xsl:value-of select="PV1_4_AdmissionType"></xsl:value-of>
                </PV1_4_AdmissionType>
                <PV1_5_PreadmitNumber>
                  <CX_0_Id>
                    <xsl:value-of select="PV1_5_PreadmitNumber/CX_0_Id"></xsl:value-of>
                  </CX_0_Id>
                </PV1_5_PreadmitNumber>
                <PV1_6_PriorPatientLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_6_PriorPatientLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_6_PriorPatientLocation>
                <PV1_7_AttendingDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_7_AttendingDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                  <XCN_1_FamilyLastName>
                    <XCN_1_0_FamilyName>
                      <xsl:value-of select="PV1_7_AttendingDoctor/XCN_1_FamilyLastName/XCN_1_0_FamilyName"></xsl:value-of>
                    </XCN_1_0_FamilyName>
                  </XCN_1_FamilyLastName>
                  <XCN_2_GivenName>
                    <xsl:value-of select="PV1_7_AttendingDoctor/XCN_2_GivenName"></xsl:value-of>
                  </XCN_2_GivenName>
                  <XCN_3_MiddleInitialOrName>
                    <xsl:value-of select="PV1_7_AttendingDoctor/XCN_3_MiddleInitialOrName"></xsl:value-of>
                  </XCN_3_MiddleInitialOrName>
                </PV1_7_AttendingDoctor>
                <PV1_8_ReferringDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_8_ReferringDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_8_ReferringDoctor>
                <PV1_9_ConsultingDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_9_ConsultingDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_9_ConsultingDoctor>
                <PV1_10_HospitalService>
                  <xsl:value-of select="PV1_10_HospitalService"></xsl:value-of>
                </PV1_10_HospitalService>
                <PV1_11_TemporaryLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_11_TemporaryLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_11_TemporaryLocation>
                <PV1_12_PreadmitTestIndicator>
                  <xsl:value-of select="PV1_12_PreadmitTestIndicator"></xsl:value-of>
                </PV1_12_PreadmitTestIndicator>
                <PV1_13_ReAdmissionIndicator>
                  <xsl:value-of select="PV1_13_ReAdmissionIndicator"></xsl:value-of>
                </PV1_13_ReAdmissionIndicator>
                <PV1_14_AdmitSource>
                  <xsl:value-of select="PV1_14_AdmitSource"></xsl:value-of>
                </PV1_14_AdmitSource>
                <PV1_15_AmbulatoryStatus>
                  <xsl:value-of select="PV1_15_AmbulatoryStatus"></xsl:value-of>
                </PV1_15_AmbulatoryStatus>
                <PV1_16_VipIndicator>
                  <xsl:value-of select="PV1_16_VipIndicator"></xsl:value-of>
                </PV1_16_VipIndicator>
                <PV1_17_AdmittingDoctor>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_17_AdmittingDoctor/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_17_AdmittingDoctor>
                <PV1_18_PatientType>
                  <xsl:value-of select="PV1_13_ReAdmissionIndicator"></xsl:value-of>
                </PV1_18_PatientType>
                <PV1_19_VisitNumber>
                  <CX_0_Id>
                    <xsl:value-of select="PV1_19_VisitNumber/CX_0_Id"></xsl:value-of>
                  </CX_0_Id>
                </PV1_19_VisitNumber>
                <PV1_20_FinancialClass>
                  <FC_0_FinancialClass>
                    <xsl:value-of select="PV1_20_FinancialClass/FC_0_FinancialClass"></xsl:value-of>
                  </FC_0_FinancialClass>
                </PV1_20_FinancialClass>
                <PV1_21_ChargePriceIndicator>
                  <xsl:value-of select="PV1_21_ChargePriceIndicator"></xsl:value-of>
                </PV1_21_ChargePriceIndicator>
                <PV1_22_CourtesyCode>
                  <xsl:value-of select="PV1_22_CourtesyCode"></xsl:value-of>
                </PV1_22_CourtesyCode>
                <PV1_23_CreditRating>
                  <xsl:value-of select="PV1_23_CreditRating"></xsl:value-of>
                </PV1_23_CreditRating>
                <PV1_24_ContractCode>
                  <xsl:value-of select="PV1_24_ContractCode"></xsl:value-of>
                </PV1_24_ContractCode>
                <PV1_25_ContractEffectiveDate>
                  <xsl:value-of select="PV1_25_ContractEffectiveDate"></xsl:value-of>
                </PV1_25_ContractEffectiveDate>
                <PV1_26_ContractAmount>
                  <xsl:value-of select="PV1_26_ContractAmount"></xsl:value-of>
                </PV1_26_ContractAmount>
                <PV1_27_ContractPeriod>
                  <xsl:value-of select="PV1_27_ContractPeriod"></xsl:value-of>
                </PV1_27_ContractPeriod>
                <PV1_28_InterestCode>
                  <xsl:value-of select="PV1_28_InterestCode"></xsl:value-of>
                </PV1_28_InterestCode>
                <PV1_29_TransferToBadDebtCode>
                  <xsl:value-of select="PV1_29_TransferToBadDebtCode"></xsl:value-of>
                </PV1_29_TransferToBadDebtCode>
                <PV1_30_TransferToBadDebtDate>
                  <xsl:value-of select="PV1_30_TransferToBadDebtDate"></xsl:value-of>
                </PV1_30_TransferToBadDebtDate>
                <PV1_31_BadDebtAgencyCode>
                  <xsl:value-of select="PV1_31_BadDebtAgencyCode"></xsl:value-of>
                </PV1_31_BadDebtAgencyCode>
                <PV1_32_BadDebtTransferAmount>
                  <xsl:value-of select="PV1_32_BadDebtTransferAmount"></xsl:value-of>
                </PV1_32_BadDebtTransferAmount>
                <PV1_33_BadDebtRecoveryAmount>
                  <xsl:value-of select="PV1_33_BadDebtRecoveryAmount"></xsl:value-of>
                </PV1_33_BadDebtRecoveryAmount>
                <PV1_34_DeleteAccountIndicator>
                  <xsl:value-of select="PV1_34_DeleteAccountIndicator"></xsl:value-of>
                </PV1_34_DeleteAccountIndicator>
                <PV1_35_DeleteAccountDate>
                  <xsl:value-of select="PV1_35_DeleteAccountDate"></xsl:value-of>
                </PV1_35_DeleteAccountDate>
                <PV1_36_DischargeDisposition>
                  <xsl:value-of select="PV1_36_DischargeDisposition"></xsl:value-of>
                </PV1_36_DischargeDisposition>
                <PV1_37_DischargedToLocation>
                  <DLD_0_DischargeLocation>
                    <xsl:value-of select="PV1_37_DischargedToLocation/DLD_0_DischargeLocation"></xsl:value-of>
                  </DLD_0_DischargeLocation>
                </PV1_37_DischargedToLocation>
                <PV1_38_DietType>
                  <CE_0_Identifier>
                    <xsl:value-of select="PV1_38_DietType/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                </PV1_38_DietType>
                <PV1_39_ServicingFacility>
                  <xsl:value-of select="PV1_39_ServicingFacility"></xsl:value-of>
                </PV1_39_ServicingFacility>
                <PV1_40_BedStatus>
                  <xsl:value-of select="PV1_40_BedStatus"></xsl:value-of>
                </PV1_40_BedStatus>
                <PV1_41_AccountStatus>
                  <xsl:value-of select="PV1_41_AccountStatus"></xsl:value-of>
                </PV1_41_AccountStatus>
                <PV1_42_PendingLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_42_PendingLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_42_PendingLocation>
                <PV1_43_PriorTemporaryLocation>
                  <PL_0_PointOfCare>
                    <xsl:value-of select="PV1_43_PriorTemporaryLocation/PL_0_PointOfCare"></xsl:value-of>
                  </PL_0_PointOfCare>
                </PV1_43_PriorTemporaryLocation>
                <PV1_44_AdmitDateTime>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="PV1_44_AdmitDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </PV1_44_AdmitDateTime>
                <PV1_45_DischargeDateTime>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="PV1_45_DischargeDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </PV1_45_DischargeDateTime>
                <PV1_46_CurrentPatientBalance>
                  <xsl:value-of select="PV1_46_CurrentPatientBalance"></xsl:value-of>
                </PV1_46_CurrentPatientBalance>
                <PV1_47_TotalCharges>
                  <xsl:value-of select="PV1_47_TotalCharges"></xsl:value-of>
                </PV1_47_TotalCharges>
                <PV1_48_TotalAdjustments>
                  <xsl:value-of select="PV1_48_TotalAdjustments"></xsl:value-of>
                </PV1_48_TotalAdjustments>
                <PV1_49_TotalPayments>
                  <xsl:value-of select="PV1_49_TotalPayments"></xsl:value-of>
                </PV1_49_TotalPayments>
                <PV1_50_AlternateVisitId>
                  <CX_0_Id>
                    <xsl:value-of select="PV1_50_AlternateVisitId/CX_0_Id"></xsl:value-of>
                  </CX_0_Id>
                </PV1_50_AlternateVisitId>
                <PV1_51_VisitIndicator>
                  <xsl:value-of select="PV1_51_VisitIndicator"></xsl:value-of>
                </PV1_51_VisitIndicator>
                <PV1_52_OtherHealthcareProvider>
                  <XCN_0_IdNumberSt>
                    <xsl:value-of select="PV1_52_OtherHealthcareProvider/XCN_0_IdNumberSt"></xsl:value-of>
                  </XCN_0_IdNumberSt>
                </PV1_52_OtherHealthcareProvider>
              </xsl:for-each>
            </PV1_PatientVisitSegment>
          </Visit>
        </Patient>
        <xsl:variable name="OrderStart" >
          &lt;Order&gt;
        </xsl:variable>
        <xsl:variable name="OrderEnd">&lt;/Order&gt;</xsl:variable>
        <xsl:for-each select="*">
          <xsl:if test="name()='ORC_CommonOrderSegment'">
            <xsl:value-of select="$OrderStart" disable-output-escaping="yes"/>
            <ORC_CommonOrderSegment>
              <ORC_1_OrderControl>
                <xsl:value-of select="ORC_1_OrderControl"></xsl:value-of>
              </ORC_1_OrderControl>
              <ORC_2_PlacerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="ORC_2_PlacerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </ORC_2_PlacerOrderNumber>
              <ORC_3_FillerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="ORC_3_FillerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </ORC_3_FillerOrderNumber>
              <ORC_4_PlacerGroupNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="ORC_4_PlacerGroupNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </ORC_4_PlacerGroupNumber>
              <ORC_5_OrderStatus>
                <xsl:value-of select="ORC_5_OrderStatus"></xsl:value-of>
              </ORC_5_OrderStatus>
              <ORC_6_ResponseFlag>
                <xsl:value-of select="ORC_6_ResponseFlag"></xsl:value-of>
              </ORC_6_ResponseFlag>
              <ORC_7_QuantityTiming>
                <TQ_0_Quantity>
                  <TQ_0_0_Quantity>
                    <xsl:value-of select="ORC_7_QuantityTiming/TQ_0_Quantity/TQ_0_0_Quantity"></xsl:value-of>
                  </TQ_0_0_Quantity>
                </TQ_0_Quantity>
              </ORC_7_QuantityTiming>
              <ORC_8_Parent>
                <EIP_0_ParentSPlacerOrderNumber>
                  <EIP_0_0_EntityIdentifier>
                    <xsl:value-of select="ORC_8_Parent/EIP_0_ParentSPlacerOrderNumber/EIP_0_0_EntityIdentifier"></xsl:value-of>
                  </EIP_0_0_EntityIdentifier>
                </EIP_0_ParentSPlacerOrderNumber>
              </ORC_8_Parent>
              <ORC_9_DateTimeOfTransaction>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="ORC_9_DateTimeOfTransaction/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </ORC_9_DateTimeOfTransaction>
              <ORC_10_EnteredBy>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_10_EnteredBy/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </ORC_10_EnteredBy>
              <ORC_11_VerifiedBy>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_11_VerifiedBy/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </ORC_11_VerifiedBy>
              <ORC_12_OrderingProvider>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
                <XCN_1_FamilyLastName>
                  <XCN_1_0_FamilyName>
                    <xsl:value-of select="ORC_12_OrderingProvider/XCN_1_FamilyLastName/XCN_1_0_FamilyName"></xsl:value-of>
                  </XCN_1_0_FamilyName>
                </XCN_1_FamilyLastName>
                <XCN_2_GivenName>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_2_GivenName"></xsl:value-of>
                </XCN_2_GivenName>
                <XCN_3_MiddleInitialOrName>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_3_MiddleInitialOrName"></xsl:value-of>
                </XCN_3_MiddleInitialOrName>
                <XCN_4_SuffixEGJrOrIii>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_4_SuffixEGJrOrIii"></xsl:value-of>
                </XCN_4_SuffixEGJrOrIii>
                <XCN_5_PrefixEGDr>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_5_PrefixEGDr"></xsl:value-of>
                </XCN_5_PrefixEGDr>
                <XCN_6_DegreeEGMd>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_6_DegreeEGMd"></xsl:value-of>
                </XCN_6_DegreeEGMd>
                <XCN_7_SourceTable>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_7_SourceTable"></xsl:value-of>
                </XCN_7_SourceTable>
                <XCN_8_AssigningAuthority>
                  <XCN_8_0_NamespaceId>
                    <xsl:value-of select="ORC_12_OrderingProvider/XCN_8_AssigningAuthority/XCN_8_0_NamespaceId"></xsl:value-of>
                  </XCN_8_0_NamespaceId>
                </XCN_8_AssigningAuthority>
                <XCN_9_NameTypeCode>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_9_NameTypeCode"></xsl:value-of>
                </XCN_9_NameTypeCode>
                <XCN_10_IdentifierCheckDigit>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_10_IdentifierCheckDigit"></xsl:value-of>
                </XCN_10_IdentifierCheckDigit>
                <XCN_11_CodeIdentifyingTheCheckDigitSchemeEmployed>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_11_CodeIdentifyingTheCheckDigitSchemeEmployed"></xsl:value-of>
                </XCN_11_CodeIdentifyingTheCheckDigitSchemeEmployed>
                <XCN_12_IdentifierTypeCode>
                  <xsl:value-of select="ORC_12_OrderingProvider/XCN_12_IdentifierTypeCode"></xsl:value-of>
                </XCN_12_IdentifierTypeCode>
              </ORC_12_OrderingProvider>
              <ORC_13_EntererSLocation>
                <PL_0_PointOfCare>
                  <xsl:value-of select="ORC_13_EntererSLocation/PL_0_PointOfCare"></xsl:value-of>
                </PL_0_PointOfCare>
              </ORC_13_EntererSLocation>
              <ORC_14_CallBackPhoneNumber>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="ORC_14_CallBackPhoneNumber/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </ORC_14_CallBackPhoneNumber>
              <ORC_15_OrderEffectiveDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="ORC_15_OrderEffectiveDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </ORC_15_OrderEffectiveDateTime>
              <ORC_16_OrderControlCodeReason>
                <CE_0_Identifier>
                  <xsl:value-of select="ORC_16_OrderControlCodeReason/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </ORC_16_OrderControlCodeReason>
              <ORC_17_EnteringOrganization>
                <CE_0_Identifier>
                  <xsl:value-of select="ORC_17_EnteringOrganization/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </ORC_17_EnteringOrganization>
              <ORC_18_EnteringDevice>
                <CE_0_Identifier>
                  <xsl:value-of select="ORC_18_EnteringDevice/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </ORC_18_EnteringDevice>
              <ORC_19_ActionBy>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="ORC_19_ActionBy/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </ORC_19_ActionBy>
            </ORC_CommonOrderSegment>
          </xsl:if>
          <xsl:if test="name()='OBR_ObservationRequestSegment'">
            <xsl:if test="local-name(preceding-sibling::*[1])!='ORC_CommonOrderSegment'">
              <xsl:value-of select="$OrderStart" disable-output-escaping="yes"/>
            </xsl:if>
            <OBR_ObservationRequestSegment>
              <OBR_1_SetIdObr>
                <xsl:value-of select="OBR_1_SetIdObr"></xsl:value-of>
              </OBR_1_SetIdObr>
              <OBR_2_PlacerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="OBR_2_PlacerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </OBR_2_PlacerOrderNumber>
              <OBR_3_FillerOrderNumber>
                <EI_0_EntityIdentifier>
                  <xsl:value-of select="OBR_3_FillerOrderNumber/EI_0_EntityIdentifier"></xsl:value-of>
                </EI_0_EntityIdentifier>
              </OBR_3_FillerOrderNumber>
              <OBR_4_UniversalServiceId>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_4_UniversalServiceId/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
                <CE_1_Text>
                  <xsl:value-of select="OBR_4_UniversalServiceId/CE_1_Text"></xsl:value-of>
                </CE_1_Text>
                <CE_2_NameOfCodingSystem>
                  <xsl:value-of select="OBR_4_UniversalServiceId/CE_2_NameOfCodingSystem"></xsl:value-of>
                </CE_2_NameOfCodingSystem>
              </OBR_4_UniversalServiceId>
              <OBR_5_PriorityObr>
                <xsl:value-of select="OBR_5_PriorityObr"></xsl:value-of>
              </OBR_5_PriorityObr>
              <OBR_6_RequestedDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_6_RequestedDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_6_RequestedDateTime>
              <OBR_7_ObservationDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_7_ObservationDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_7_ObservationDateTime>
              <OBR_8_ObservationEndDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_8_ObservationEndDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_8_ObservationEndDateTime>
              <OBR_9_CollectionVolume>
                <CQ_0_Quantity>
                  <xsl:value-of select="OBR_9_CollectionVolume/CQ_0_Quantity"></xsl:value-of>
                </CQ_0_Quantity>
              </OBR_9_CollectionVolume>
              <OBR_10_CollectorIdentifier>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="OBR_10_CollectorIdentifier/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </OBR_10_CollectorIdentifier>
              <OBR_11_SpecimenActionCode>
                <xsl:value-of select="OBR_11_SpecimenActionCode"></xsl:value-of>
              </OBR_11_SpecimenActionCode>
              <OBR_12_DangerCode>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_12_DangerCode/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_12_DangerCode>
              <OBR_13_RelevantClinicalInfo>
                <xsl:value-of select="OBR_13_RelevantClinicalInfo"></xsl:value-of>
              </OBR_13_RelevantClinicalInfo>
              <OBR_14_SpecimenReceivedDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_14_SpecimenReceivedDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_14_SpecimenReceivedDateTime>
              <OBR_15_SpecimenSource>
                <SPS_0_SpecimenSourceNameOrCode>
                  <SPS_0_0_Identifier>
                    <xsl:value-of select="OBR_15_SpecimenSource/SPS_0_SpecimenSourceNameOrCode/SPS_0_0_Identifier"></xsl:value-of>
                  </SPS_0_0_Identifier>
                </SPS_0_SpecimenSourceNameOrCode>
              </OBR_15_SpecimenSource>
              <OBR_16_OrderingProvider>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="OBR_16_OrderingProvider/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </OBR_16_OrderingProvider>
              <OBR_17_OrderCallbackPhoneNumber>
                <XTN_0_9999999999X99999CAnyText>
                  <xsl:value-of select="OBR_17_OrderCallbackPhoneNumber/XTN_0_9999999999X99999CAnyText"></xsl:value-of>
                </XTN_0_9999999999X99999CAnyText>
              </OBR_17_OrderCallbackPhoneNumber>
              <OBR_18_PlacerField1>
                <xsl:value-of select="OBR_18_PlacerField1"></xsl:value-of>
              </OBR_18_PlacerField1>
              <OBR_19_PlacerField2>
                <xsl:value-of select="OBR_19_PlacerField2"></xsl:value-of>
              </OBR_19_PlacerField2>
              <OBR_20_FillerField1>
                <xsl:value-of select="OBR_20_FillerField1"></xsl:value-of>
              </OBR_20_FillerField1>
              <OBR_21_FillerField2>
                <xsl:value-of select="OBR_21_FillerField2"></xsl:value-of>
              </OBR_21_FillerField2>
              <OBR_22_ResultsRptStatusChngDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_22_ResultsRptStatusChngDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_22_ResultsRptStatusChngDateTime>
              <OBR_23_ChargeToPractice>
                <MOC_0_DollarAmount>
                  <MOC_0_0_Quantity>
                    <xsl:value-of select="OBR_23_ChargeToPractice/MOC_0_DollarAmount/MOC_0_0_Quantity"></xsl:value-of>
                  </MOC_0_0_Quantity>
                </MOC_0_DollarAmount>
              </OBR_23_ChargeToPractice>
              <OBR_24_DiagnosticServSectId>
                <xsl:value-of select="OBR_24_DiagnosticServSectId"></xsl:value-of>
              </OBR_24_DiagnosticServSectId>
              <OBR_25_ResultStatus>
                <xsl:value-of select="OBR_25_ResultStatus"></xsl:value-of>
              </OBR_25_ResultStatus>
              <OBR_26_ParentResult>
                <PRL_0_Obx3ObservationIdentifierOfParentResult>
                  <PRL_0_0_Identifier>
                    <xsl:value-of select="OBR_26_ParentResult/PRL_0_Obx3ObservationIdentifierOfParentResult/PRL_0_0_Identifier"></xsl:value-of>
                  </PRL_0_0_Identifier>
                </PRL_0_Obx3ObservationIdentifierOfParentResult>
              </OBR_26_ParentResult>
              <OBR_27_QuantityTiming>
                <TQ_0_Quantity>
                  <TQ_0_0_Quantity>
                    <xsl:value-of select="OBR_27_QuantityTiming/TQ_0_Quantity/TQ_0_0_Quantity"></xsl:value-of>
                  </TQ_0_0_Quantity>
                </TQ_0_Quantity>
              </OBR_27_QuantityTiming>
              <OBR_28_ResultCopiesTo>
                <XCN_0_IdNumberSt>
                  <xsl:value-of select="OBR_28_ResultCopiesTo/XCN_0_IdNumberSt"></xsl:value-of>
                </XCN_0_IdNumberSt>
              </OBR_28_ResultCopiesTo>
              <OBR_29_Parent>
                <EIP_0_ParentSPlacerOrderNumber>
                  <EIP_0_0_EntityIdentifier>
                    <xsl:value-of select="OBR_29_Parent/EIP_0_ParentSPlacerOrderNumber/EIP_0_0_EntityIdentifier"></xsl:value-of>
                  </EIP_0_0_EntityIdentifier>
                </EIP_0_ParentSPlacerOrderNumber>
              </OBR_29_Parent>
              <OBR_30_TransportationMode>
                <xsl:value-of select="OBR_30_TransportationMode"></xsl:value-of>
              </OBR_30_TransportationMode>
              <OBR_31_ReasonForStudy>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_31_ReasonForStudy/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_31_ReasonForStudy>
              <OBR_32_PrincipalResultInterpreter>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_32_PrincipalResultInterpreter/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_32_PrincipalResultInterpreter>
              <OBR_33_AssistantResultInterpreter>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_33_AssistantResultInterpreter/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_33_AssistantResultInterpreter>
              <OBR_34_Technician>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_34_Technician/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_34_Technician>
              <OBR_35_Transcriptionist>
                <NDL_0_Name>
                  <NDL_0_0_IdNumberSt>
                    <xsl:value-of select="OBR_35_Transcriptionist/NDL_0_Name/NDL_0_0_IdNumberSt"></xsl:value-of>
                  </NDL_0_0_IdNumberSt>
                </NDL_0_Name>
              </OBR_35_Transcriptionist>
              <OBR_36_ScheduledDateTime>
                <TS_0_TimeOfAnEvent>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/TS_0_TimeOfAnEvent"></xsl:value-of>
                </TS_0_TimeOfAnEvent>
              </OBR_36_ScheduledDateTime>
              <OBR_37_NumberOfSampleContainers>
                <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_37_NumberOfSampleContainers"></xsl:value-of>
              </OBR_37_NumberOfSampleContainers>
              <OBR_38_TransportLogisticsOfCollectedSample>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_38_TransportLogisticsOfCollectedSample/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_38_TransportLogisticsOfCollectedSample>
              <OBR_39_CollectorSComment>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_39_CollectorSComment/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_39_CollectorSComment>
              <OBR_40_TransportArrangementResponsibility>
                <CE_0_Identifier>
                  <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_40_TransportArrangementResponsibility/CE_0_Identifier"></xsl:value-of>
                </CE_0_Identifier>
              </OBR_40_TransportArrangementResponsibility>
              <OBR_41_TransportArranged>
                <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_41_TransportArranged"></xsl:value-of>
              </OBR_41_TransportArranged>
              <OBR_42_EscortRequired>
                <xsl:value-of select="OBR_36_ScheduledDateTime/OBR_42_EscortRequired"></xsl:value-of>
              </OBR_42_EscortRequired>
            </OBR_ObservationRequestSegment>
          </xsl:if>
          <xsl:if test="name()='OBX_ObservationResultSegment'">
            <Observation>
              <OBX_ObservationResultSegment>
                <OBX_1_SetIdObx>
                  <xsl:value-of select="OBX_1_SetIdObx"></xsl:value-of>
                </OBX_1_SetIdObx>
                <OBX_2_ValueType>
                  <xsl:value-of select="OBX_2_ValueType"></xsl:value-of>
                </OBX_2_ValueType>
                <OBX_3_ObservationIdentifier>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                  <CE_1_Text>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_1_Text"></xsl:value-of>
                  </CE_1_Text>
                  <CE_2_NameOfCodingSystem>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_2_NameOfCodingSystem"></xsl:value-of>
                  </CE_2_NameOfCodingSystem>
                  <CE_3_AlternateIdentifier>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_3_AlternateIdentifier"></xsl:value-of>
                  </CE_3_AlternateIdentifier>
                  <CE_4_AlternateText>
                    <xsl:value-of select="OBX_3_ObservationIdentifier/CE_4_AlternateText"></xsl:value-of>
                  </CE_4_AlternateText>
                </OBX_3_ObservationIdentifier>
                <OBX_4_ObservationSubId>
                  <xsl:value-of select="OBX_4_ObservationSubId"></xsl:value-of>
                </OBX_4_ObservationSubId>
                <OBX_5_ObservationValue>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                  <CE_1_Text>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_1_Text"></xsl:value-of>
                  </CE_1_Text>
                  <CE_2_NameOfCodingSystem>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_2_NameOfCodingSystem"></xsl:value-of>
                  </CE_2_NameOfCodingSystem>
                  <CE_3_AlternateIdentifier>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_3_AlternateIdentifier"></xsl:value-of>
                  </CE_3_AlternateIdentifier>
                  <CE_4_AlternateText>
                    <xsl:value-of select="OBX_5_ObservationValue/CE_4_AlternateText"></xsl:value-of>
                  </CE_4_AlternateText>
                </OBX_5_ObservationValue>
                <OBX_6_Units>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_6_Units/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                </OBX_6_Units>
                <OBX_7_ReferencesRange>
                  <xsl:value-of select="OBX_7_ReferencesRange"></xsl:value-of>
                </OBX_7_ReferencesRange>
                <OBX_8_AbnormalFlags>
                  <xsl:value-of select="OBX_8_AbnormalFlags"></xsl:value-of>
                </OBX_8_AbnormalFlags>
                <OBX_9_Probability>
                  <xsl:value-of select="OBX_9_Probability"></xsl:value-of>
                </OBX_9_Probability>
                <OBX_10_NatureOfAbnormalTest>
                  <xsl:value-of select="OBX_10_NatureOfAbnormalTest"></xsl:value-of>
                </OBX_10_NatureOfAbnormalTest>
                <OBX_11_ObservationResultStatus>
                  <xsl:value-of select="OBX_11_ObservationResultStatus"></xsl:value-of>
                </OBX_11_ObservationResultStatus>
                <OBX_12_DateLastObsNormalValues>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="OBX_12_DateLastObsNormalValues/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </OBX_12_DateLastObsNormalValues>
                <OBX_13_UserDefinedAccessChecks>
                  <xsl:value-of select="OBX_13_UserDefinedAccessChecks"></xsl:value-of>
                </OBX_13_UserDefinedAccessChecks>
                <OBX_14_DateTimeOfTheObservation>
                  <TS_0_TimeOfAnEvent>
                    <xsl:value-of select="OBX_14_DateTimeOfTheObservation/TS_0_TimeOfAnEvent"></xsl:value-of>
                  </TS_0_TimeOfAnEvent>
                </OBX_14_DateTimeOfTheObservation>
                <OBX_15_ProducerSId>
                  <CE_0_Identifier>
                    <xsl:value-of select="OBX_15_ProducerSId/CE_0_Identifier"></xsl:value-of>
                  </CE_0_Identifier>
                  <CE_1_Text>
                    <xsl:value-of select="OBX_15_ProducerSId/CE_1_Text"></xsl:value-of>
                  </CE_1_Text>
                  <CE_2_NameOfCodingSystem>
                    <xsl:value-of select="OBX_15_ProducerSId/CE_2_NameOfCodingSystem"></xsl:value-of>
                  </CE_2_NameOfCodingSystem>
                </OBX_15_ProducerSId>
              </OBX_ObservationResultSegment>
              <xsl:if test="local-name(following-sibling::*[position()])='NTE_NotesAndCommentsSegment_2'">
                <NTE_NotesAndCommentsSegment_2>
                  <NTE_1_SetIdNte>
                    <xsl:value-of select="NTE_1_SetIdNte"></xsl:value-of>
                  </NTE_1_SetIdNte>
                  <NTE_2_SourceOfComment>
                    <xsl:value-of select="NTE_2_SourceOfComment"></xsl:value-of>
                  </NTE_2_SourceOfComment>
                  <NTE_3_Comment>
                    <xsl:value-of select="NTE_3_Comment"></xsl:value-of>
                  </NTE_3_Comment>
                </NTE_NotesAndCommentsSegment_2>
              </xsl:if>
            </Observation>
            <xsl:if test="local-name(following-sibling::*[position()])!='OBX_ObservationResultSegment'">
              <xsl:if test="local-name(following-sibling::*[position()])!='NTE_NotesAndCommentsSegment_2'">
                <xsl:value-of select="$OrderEnd" disable-output-escaping="yes"/>
              </xsl:if>
            </xsl:if>
          </xsl:if>
        </xsl:for-each>
      </CompleteOrder>
    </ns0:ORU_R01_231_GLO_DEF>
  </xsl:template>
</xsl:stylesheet>

Hope that this helps you understand what is going on, and I hope that this entry will assist you in getting up to speed quickly with HL7.

Now that I have written this, I am asking myself, if no one has come across these issues, and either complained to me or Microsoft that would have prompted a change, is anyone really using BizTalk to do true HL7 processing? I am almost leaning towards no.

The only other answer I can think of, is that I must be the one to be laughed at, as this XSLT was not too easy for me to craft, and everyone who enters the BizTalk world is a LOT smarter than me.