re:Node order after mapping
- From: "gopal" <gopal@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 26 Feb 2006 17:22:26 -0800
Hi Samuel,
I am having a simiar issue could you please guide me how to resolve this
issue
I am new to XSLT and i dont know if it is possible to write a custom XSLT to
map a flat file repeating structure to predefined xml structure.
I have a requirement from a client.They have given predefined xml structure
we can not add any extra level node in the destination xml for repeating
structure.
i have a flat file with the following structure
Document # Max Unbounded
Header
Vendor #1 Max unbounded
Accounting #1 Max 2 min 2
Accounting #2
Vendor# 2
Accounting #3
Accounting #4
.......so on
each vendor record should be followed by two accounting records.
For the repeating sequence in the flat file i defined record which includes
Venodr record and Accounting record in the source side.
But In the desitination i can not add any Record for the repeating
sequence.The stucture is predefined for destination XML.
I tried several ways wiht out xslt but not able to generate the
order/sequence.
I have deadlines and i am stuck with this issue.
Thanks
gopal
"Samuel L" wrote:
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.
- Follow-Ups:
- Re: re:Node order after mapping
- From: Greg Forsythe
- Re: Node order after mapping
- From: BTSWizard
- Re: re:Node order after mapping
- Prev by Date: Re: performance problem getting WMI "HostName" propertie
- Next by Date: Re: EDI to XML problem
- Previous by thread: Re: BTS 2004 not connecting to SQL2005
- Next by thread: Re: Node order after mapping
- Index(es):
Relevant Pages
|