BizTalk, Another Custom XSLT mapping sample.

The below mapping example could most likely be accomplished using a series of BizTalk maps. In the maps,  Table Looping / Table Extractor / Looping functoids etc. could be used to perform the transformation. Sometimes it makes sense to craft your own custom XSLT to execute the complete transformation. The sample input / output messages for the transformation as below. Also included is the custom XSLT for the transformation. You can also download the source code (at end of this blog entry). 

INPUT Message:

--> For each "contenedor" node, in the output message must repeat the sequence of segments ORC + RQD (According to the standard HL7 v.2.3.1)
--> For each "prueba" node, in the output message must repeat the sequence of segments ORC + OBR
--> For each "parametro" node, in the output message must repeat the segment NTE

For the below output, the order of the nodes is also important. The order relates back to the input message.

OUTPUT Message should be:

MSH||||.|
ORC||||.|
RQD||||.|
ORC||||.|
RQD||||.|
ORC||||.|
OBR||||.|
NTE||||.|
NTE||||.|
ORC||||.|
OBR||||.|
NTE||||.|
NTE||||.|
NTE||||.|


The custom XSLT for the mapping/transformation looks like below:

The above XSLT can be placed in a scripting functoid in the map as discussed HERE
Or the custom XSLT can be placed in a separate file, with the map's property ->  Custom XSLT Path pointing to the file (see below)

Download the solution HERE

Conclusion: In some cases it is much simpler to write your own custom XSLT for a BizTalk map.
Note: You can also perform a transformation in a BizTalk map using a combination of custom XSLT and links/functoids (see below links)
Note: Using functoids or a combination of functoids in a map are sometimes not enough to perform a transformation or a portion of a transformation. Using custom XSLT for the transformation or a portion of the transformation may be the answer.

Below is more information on using custom XSLT in BizTalk maps:

Extending Mapper (BizTalk Server SDK Samples)

Creating Nodes from Flat Data in BizTalk 2004 Maps

Logical Message Splitting in BizTalk Server 2004

Implementation of Message Transformation Normaliser Pattern in the BizTalk 2004

Sorting XML Nodes with the BizTalk Mapper

Debugging XSLT

Comments

  • matt February 26, 2006 1:18 PM

    Hi,
    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
    Venodr# Max unbounded
    Accounting #1 Max 2 min 2
    Accounting #2
    Vendor#
    Accounting #3
    Accounting #4

    each vendor record should be followed by two accounting records.

    For the repeating sequence in the flat file i can define 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.Can some one help me how to solve this.
    Thanks
    Vijaya

    nvijaya1@gmail.com



  • matt February 26, 2006 7:12 PM

    I would have to see the Flat File Schema that you have created and a sample of the XML that must be transformed from it. Also the XSD schema that represents destination xml

  • matt February 26, 2006 10:15 PM

    Hi Matt,

    Thankyou so much for getting back to me.I just sent all the information to the given ID Matt@ObjectSharp.com

    Thanks
    Vijaya

  • matt August 24, 2006 6:05 PM

    Hi Matt
    We have scenario where i need to get only the first occurence of an xml node and pass it to the output node.

  • Minty Fresh December 21, 2006 12:14 PM

    Legend blog = blog post core = BizTalk Server 2006 core documentation hosted on MSDN. lib = non-core

Leave a Comment

(required) 
(optional)
(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS