re:Node order after mapping



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.


.



Relevant Pages

  • Re: re:Node order after mapping
    ... Can you email me an example flatfile, your two schemas and your map to ... I am new to XSLT and i dont know if it is possible to write a custom XSLT ... I have a requirement from a client.They have given predefined xml ... Accounting #1 Max 2 min 2 ...
    (microsoft.public.biztalk.general)
  • Re: Using PHP to parse specific XML tag content?
    ... XML --> HTML transformation in testing environment. ... run just fine under Windows using Cygwin, and, unless I'm ... but you have to learn XSLT or use whatever defaults ...
    (comp.lang.php)
  • Subject: ANN: 4Suite XML 1.0b2
    ... 4Suite XML - XML, XPath, XSLT, related technologies and support ... 4Suite RDF - RDF processing libraries and stand-alone DBMS ...
    (comp.lang.python.announce)
  • EditiX 2.1 - XML Editor & XSLT Debugger
    ... We are glad to announce the availability of EditiX 2.1. ... cross-platform and easy to use XML Editor and XSLT Debugger designed to ... New docking windows for the XSLT Editor ...
    (comp.lang.java.softwaretools)
  • Re: What is/is not considered to be good OO programming
    ... Brit programmers have common sense, ... XSLT is overblown and introduces ... Then your guys haven't learnt how to use XSL properly. ... > but XML, then use XSLT to style this output for the end user. ...
    (comp.lang.php)