BizTalk Server General - Node order after mapping

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > February 2006 > Node order after mapping





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Node order after mapping
MCE

2005-12-04, 8:48 pm

Hi folks,

I have a source schema with repeating nodes which I am mapping to an
output schema. I require that the output XML has it's nodes in the
same order as the corresponding incoming nodes but the output nodes
always end up grouped together, eg.

Incoming XML

<InputNode1/>
<InputNode2/>
<InputNode1/>
<InputNode2/>

Output XML

<OutputNode1/>
<OutputNode1/>
<OutputNode2/>
<OutputNode2/>

whereas I require

<OutputNode1/>
<OutputNode2/>
<OutputNode1/>
<OutputNode2/>

I've tried with and without a looping functoid, using and not using a
sequence node in both the source and output schema but nothing I do
has worked. If anyone has any ideas I would appreciate the help.
Thankyou.

MCE

2005-12-05, 8:51 pm

Is anybody able to help me out here? Even if I could just be pointed
towards some relevant documentation I would appreciate it.

Samuel L

2005-12-06, 2:52 am

Hi MCE!

Could you please provide with a more detailed description of your scenarrio?
That would be helpful in trying to help you.

What I want to know is some details about your schemas.
Are the input nodes (InputNode1 & InputNode2) of the same type in some
records? Could there be erbitrary many of those?

Please descibe your problem scenario a bit further and I will try to help you!

// Samuel L

Pabba

2005-12-06, 5:54 pm

Do you have OutputNode1 & OutputNode2 grouped under a parent node in
the target schema? If no, send me the whole source & target schema's.
If yes, this grouping should be of <sequence> type that enables the
schema to present the output xml nodes in a group sequential format
provided a Looping funtoid is linked between the source <parentNode>
and target <ParentNode>, that results in output similar to:

<ParentNode> [which is of sequence type in the target schema]
<OutputNode1>
<OutputNode2>
</ParentNode>
<ParentNode>
<OutputNode1>
<OutputNode2>
</ParentNode>

Let me know if this helps, else I can provide you a sample.

Regards,
Kiran Pabba

MCE

2005-12-13, 7:54 am

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.

Samuel L

2005-12-13, 7:54 am

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.
>
>

Donato Modugno

2005-12-15, 5:58 pm

Hi MCE,
i had the same problem to transform my order schema to outbound ORM message
with biztalk mapper.
In my opinion there are no ways to reach it with Btz mapper.
It can be done only with a custon xslt.
If you like, follow this link to microsoft.public.xsl to read the great help
that gave to me J. Gillis to learn and solve this issue.

"http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.xsl&mid=622244e6-61c7-493f-9735-9d4dc084d939&sloc=en-us"

I hope it can help you in same way.


"MCE" <english@intecgroup.com-dot-au.no-spam.invalid> ha scritto nel
messaggio news:jt6dnZsUs9agCAPeRVn_vA@giganews.com...
> 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.
>



gopal

2006-02-26, 8:47 pm

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:
[vbcol=seagreen]
> 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:
>
BTSWizard

2006-02-27, 5:51 pm

Hi Guys,

A few years back I found this site.

http://www.jenitennison.com/

She is THE master of XSLT, XML, etc. I highly recommend her book on
XSLT, it discusses these issues and others, and is the only reference
you will need.

Good luck.

Curt

Greg Forsythe

2006-02-27, 5:51 pm

gopal.

Can you email me an example flatfile, your two schemas and your map to
greg.forsythe at gmail.com

Greg

"gopal" <gopal@discussions.microsoft.com> wrote in message
news:F5C25F88-B118-4D74-8179-F499E5D89DF1@microsoft.com...[vbcol=seagreen]
> 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:
>


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com