Castle Windsor and non-HTTP Protocol WCF Services

I had been working quite happily with Castle Windsor and WCF services using WCF Facility when implemented through an HTTP binding of some description. You simply hook in the DefaultServiceHostFactory from Castle.Facilities.WcfIntegration into your ServiceHost declaration such as the following example:


<%@ ServiceHost Language=”C#” Debug=”true” Service=”MyService” CodeBehind=”MyService.svc.cs”


Factory=”Castle.Facilities.WcfIntegration.DefaultServiceHostFactory, Castle.Facilities.WcfIntegration” %>


You would then register the WindsorContainer within the Application_Start event of your Global.asax like so or however you prefer register your components, the point being it is done in the Application_Start event.


protected void Application_Start(object sender, EventArgs e)


{


   var container = new WindsorContainer(“ioc.config”);


   DefaultServiceHostFactory.RegisterContainer(container.Kernel);


}


However, let’s say you are binding to net.tcp and hosting in WAS (Windows Process Activation Service)? This event will not get called, so you need to find another way to initialise your Castle Windsor container.


I confess I spent a while looking at the Host Factory in more detail, looking to wrap the DefaultServiceHostFactory. However, there appears to be a far simpler solution and that is to make use of the little documented AppInitialize method. If you create a class (any class), put it into the ASP.NET App_Code folder in your project and give it a method signature as defined below, this little baby will get fired exactly when you want it to. You can then initialise your IoC container in there.


public class InitialiseService


{


   /// <summary>


   /// Application initialisation method where we register our IOC container.


   /// </summary>


   public static void AppInitialize()


   {


      var container = new WindsorContainer(“ioc.config”);


      DefaultServiceHostFactory.RegisterContainer(container.Kernel);


   }

}

Our offer still stands and you know where to find us…

I talked about the results of a benchmarking study performed by Greg Leake a couple months back on my blog. Greg took a hard look at Windows Server 2008 and the .NET Framework 3.5 in comparison to IBM’s Power6 and WebSphere 7 from both a cost and performance standpoint. The results  show that customers can save up to  81% in total system costs  by running applications on Windows Server 2008 rather than IBM WebSphere 7 on Power6/AIX.  The study also shows that Power6 customers who switch to Windows Server 2008, but continue to use WebSphere, could save up to 66%. What’s more, these cost cutting measures do not come at the sacrifice of performance; customers could see an increase in performance up to 57% by employing .NET Framework and/or Windows Server 2008.


 


Why do I bring this up again? Well, we’re not done putting our platform to the test! Recently, we discovered that IBM quietly published their own benchmarking results to attempt to invalidate our original results. This provides us with yet another opportunity to make some comparisons, and bring them out to our collective customers in a public forum. The outcome – we stand by our previously published results and my earlier invitation stands to have IBM to meet us in an independent lab to perform additional testing of the .NET StockTrader and WSTest benchmark workloads and pricing analysis of the middle tier application servers tested in our benchmark report.


 


I guess the only thing I’m left wondering about is who will love Windows next?

CloudCasts Update

I’ve spent a bit of time with CloudCasts (formally Cloud TV). I changed the name for a couple of reasons, primarily because the domain name cloudcasts.net was available. I’m still hosting in Azure, and the original links will work as long as its Azure hosted, but you should update the links to use www.cloudcasts.net so they don’t break if I move it to another platform.
I’ve added a couple of new webcasts, Visual Studio 2010 WCF Project Templates and Book Review – SOA Patterns with BizTalk Server 2009 (great book by the way). The book review is an experiment, if it’s popular I will maybe do some more. (If you would like me to review any books, please contact me. I make a point of reading most of the book before doing the review, so the throughput will probably be about one per month.)
I’m still on the lookout for new contributors, so if you want to have a go, grab a copy of Camtasia (there’s a 30 day full featured free trial version which should allow you to get a few webcasts done). Try to keep them to around 20 minutes, (the limit of the average developer attention span :-), you can always do a few short ones instead of one long one. Please contact me if you have anything to add, the update functionality on the site is not too hot.
MBVMMC – Latest Version

MBVMMC – Latest Version

Version 1.10 


New features :


– Allow to generate also automatically and periodically MBV reports by creating a Windows Scheduled Task


– Group  now the MBV reports per targeted BT group


– Display an exclamation mark in node for MBV Reports having Red Warnings


– Use now File Notification Services to detect new or deleted MBV reports in monitored output folder



 


Version 1.0  


Features :


– Allow to generate manually MBV reports by running in hidden mode the console version of MBV (BTSDBCOLLECT.EXE)


– Create nodes list  corresponding to generated MBV reports found in the monitored output folder


– For each MBV report node,  sub nodes are created to represent each section of an MBV report


– Allow to access directly to a MBV report Section like the “Warnings” one


– For each selected section node, right view in the MMC show the corresponding MBV report section in HTML format

HL7 Best Practices

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.

BizTalk DevCenter – check it out!

The BizTalk support team is now adding content to the BizTalk Developer Center on MSDN, especially the Support page:


http://msdn.microsoft.com/en-us/biztalk/default.aspx


Our goal is to continually update these pages with the following information:



  • Common call generators, including Symptoms and potential Resolutions

  • Potential scenarios and their fixes

  • Contributing to the monthly theme

  • Providing learning materials, including some of the same BizTalk 2009 training materials that the BizTalk support team used:


BizTalk Server Training from Microsoft Customer Service and Support
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=459bd96f-0c52-49ac-bb78-e1868c2d3121



We encourage you to browse the BizTalk DevCenter. New information is being added on a regular basis.


Thanks!
Mandi

Configuration Manager – New Release

Ive just released a new version of the configuration manager tool which I used in the BizTalk Light and Easy viewing video. This tool is used to help you manage the different settings needed for binding and configuration files across different environments and allows you to connect this with your build process.

The tool is available on codeplex at: http://configsettingstool.codeplex.com/

The light and easy video is at: http://blogs.breezetraining.com.au/mickb/2009/07/08/UnofficalLaunchOfTheBizTalk2009LightAndEasyWebCastSeries.aspx