12-13-05 12:54 PM
MCE... You're right about that it is a hard part to get the desired order 1
2
1 2 instead of 1 1 2 2... It seems impossible to me using the BizTalk mapper
!
On the other hand, this can be done using some custom XSLT.
The good: You can solve the problem
The bad: You have to make all mappings by writing code
I don't know how familiar you are with XSLT, so I will start by just giving
you a brief description. Then feel free to ask if you have any questions!
1) Insert a scripting functoid in the BizTalk mapper.
2) Connect it to the root node of the destination and modify this code so
that it fits your exact schemas:
-------------------------------------------------------
// first the main template which is applied to whole source doc
<xsl:template name="MyXsltTemplate">
<ORM_O01_231_GLO_DEF>
<xsl:for-each select="/child::*/child::*">
<xsl:apply-templates select="current()" />
</xsl:for-each>
</ORM_O01_231_GLO_DEF>
</xsl:template>
// then one template for the ORC's
<xsl:template match="OrderCommon">
<ORC_CommonOrderSegment>
..a number of elements...
</ORC_CommonOrderSegment>
</xsl:template>
// and at last one template for the OBR's
<xsl:template match="ObservationRequest">
<OBR_ObservationRequestSegment>
..a number of elements...
</OBR_ObservationRequestSegment>
</xsl:template>
-------------------------------------------------------
Hope this helps you in some way!
Good luck and please let me know if you have any strugglings.
"MCE" wrote:
> Thankyou for your replies Samuel L and Pabba. I apologise that it has
> taken me a week to respond but some other production issues came up
> that required my urgent attention.
>
> My incoming XML will look like this:
>
> <RequestTest
> SendingApplication=""
> SendingFacility=""
> ...more attributes...
> AccountID=""
> <OrderCommon
> OrderControl=""
> ...further attributes...
> />
> <ObservationRequest
> TestOrdered=""
> ...further attributes...
> />
> <OrderCommon
> OrderControl=""
> ...further attributes...
> />
> <ObservationRequest
> TestOrdered=""
> ...further attributes...
> />
> ...more OrderCommon and ObservationRequest elements as required...
> </RequestTest>
>
>
> The output XML, which is provided by the HL7 Accelerator, looks like
> this:
>
> <ORM_O01_231_GLO_DEF>
> <PID_PatientIdentificationSegment>
> ...a number of elements...
> </PID_PatientIdentificationSegment>
> <PV1_PatientVisitSegment>
> ...a number of elements...
> </PV1_PatientVisitSegment>
> <GT1_GuarantorSegment>
> ...a number of elements...
> </GT1_GuarantorSegment>
> <BLG_BillingSegment>
> ...a number of elements...
> </BLG_BillingSegment>
> <Sequence>
> <ORC_CommonOrderSegment>
> ...a number of elements...
> </ORC_CommonOrderSegment>
> <OBR_ObservationRequestSegment>
> ...a number of elements...
> </OBR_ObservationRequestSegment>
> <ORC_CommonOrderSegment>
> ...a number of elements...
> </ORC_CommonOrderSegment>
> <OBR_ObservationRequestSegment>
> ...a number of elements...
> </OBR_ObservationRequestSegment>
> ...further ORC and OBR nodes corresponding to incoming message...
> </Sequence>
> </ORM_O01_231_GLO_DEF>
>
> The attributes under the RequestTest node map to elements in the PID,
> PV1, GT1 and BLG nodes. There is no problem with this part of the
> mapping. The problem comes when trying to map the ORC and OBR
> sections. In the ouput they are required to be in the order of
>
> ORC
> OBR
> ORC
> OBR
> etc.
>
> corresponding to the incoming XML. However, no matter what I try they
> come out as
>
> ORC
> ORC
> OBR
> OBR
>
> They cannot be under a parent node in the output XML as this would not
> allow them to be serialised to HL7. I thought the sequence node was
> supposed to force elements to be in a certain order but this has not
> worked. I'm quite happy to change my incoming XML if necessary.
>
>
[ Post a follow-up to this message ]
|