BizTalk - Need to Create the Custom XSLT for the Below Scenario

Asked By Bharath Kumar on 21-May-12 09:56 AM
Hi,

All i need to Solve the Below Scenario. Please Help..I am Trying to get rid of this more that 3 days...


I am trying to map with the above Looping situation. I have flat target schema (CSV) .I have Loops on source (DetailLoop1, InnerDetailLoop and then DetailLoop2). DetailLoop1 and DetailLoop2 are in parallel hierarchies.  From DetailLoop2 I am mapping the field DL2Field5 to the target field Field5. However this mapping should occur based on the match of value of fields DL1PK (rpimary key) of DetailLoop1 and DL1PK field of DetailLoop2. And the rest of the fields of Detail Loop1 should get mapped to the same record on the target side based on appropriate match condition.

  With the above mapping it works for only one match. Does not work for the rest. Tried putting looping functoid. That results in the Field5 not getting mapped at all (i.e no match happens). Any Ideas how to do this. If XSLT is the only option , cud you please provide a pseudo code/sample.Thanks!

  <Header>
    <HField1>HField1_0</HField1>
    <HField2>HField2_0</HField2>
    </Header>
    <DetailLoop1>
    <DL1Field3>DL1Field3_1</DL1Field3>
    <DL1Field4>DL1Field4_1</DL1Field4>
    <DL1PK>MatchValue1</DL1PK>
    </DetailLoop1>
    <DetailLoop1>
    <DL1Field3>DL1Field3_2</DL1Field3>
    <DL1Field4>DL1Field4_2</DL1Field4>
    <DL1PK>MatchValue2</DL1PK>
    </DetailLoop1>
     <DetailLoop2>
    <DL2Field5>DL2Field5_1</DL2Field5>
    <DL2Field6>DL2Field6_1</DL2Field6>
    <DL1PK>MatchValue1</DL1PK>
    </DetailLoop2>
    <DetailLoop2>
    <DL2Field5>DL2Field5_2</DL2Field5>
    <DL2Field6>DL2Field6_2</DL2Field6>
    <DL1PK>MatchValue2</DL1PK>
    </DetailLoop2>

(I need to use only the XSLT, i have the Solution using the Mapper, but it degrades my Performance)

Thanks, - Bharath






 

RAJASEKHAR RAJENDRAN replied to Bharath Kumar on 22-May-12 12:38 AM
Bharath,

If you are inside the DetailLoop1 and wants the DL2Field5  inside the DetailLoop2 record where Dl1PK is equal to your local DL1PK, you should be able to do something like the below.

<xsl:variable name="PK" select="DL1PK" />
 
<Field7>
 
<xsl:value-of select="//DetailLoop2[DL1PK = $PK]/DL5Field5" />
 
</Field7>

I hope the Above solves your Need.

Thanks & Regards,
Rajasekhar.R
http://rajasekharcbe-biztalk.blogspot.in/ 

Bharath Kumar replied to RAJASEKHAR RAJENDRAN on 22-May-12 01:20 AM
Hi,

Rajasekar thanks for your solution that solves and suits my need. 
I have solved it by following  the steps suggested by you.


Thanks once again, -
Bharath
RAJASEKHAR RAJENDRAN replied to Bharath Kumar on 22-May-12 08:16 AM
Bharath,

The below shows some of the Links to grasp some more knowledge in XSLT.
Also, By using the Custom XSLT your Performance is Increased as Explained by me  in the article ( http://social.technet.microsoft.com/wiki/contents/articles/10001.biztalk-virtual-mapper-vs-custom-xslt-en-us.aspx ) as suggested by Somesh Yadav above.


http://msdn.microsoft.com/en-us/library/aa561557.aspx 
http://alamnaushad.wordpress.com/2012/03/03/biztalk-map-using-custom-xslt/ 
http://www.codeproject.com/Articles/13262/Using-Custom-XSLT-Transformations-in-BizTalk-Serve 
http://www.codeproject.com/Articles/13262/Using-Custom-XSLT-Transformations-in-BizTalk-Serve 


Thanks & Regards,
Rajasekhar.R
Bharath Kumar replied to RAJASEKHAR RAJENDRAN on 22-May-12 08:27 AM
Rajasekar,

Thanks for you suggestions, 
I will look through the XSLT with some tutorials.
By viewing the Article, i though of using the XSLT in all the Projects, because i might get the Best Performance rather than using the Mapper.

Thanks - Bharath