First let us discussed about the problem:I have a source schema which is in the following format:
Now I want my destination schema in the following format:
Note: Check I want the Ord1 and OrdName1 in OrderInfo as well as Ord2 and OrdName2 in OrderInfo too. So I need the value of above in one record (node) of Destination schema. So for to do the above functionality I have used the BizTalk map. What I have done is I have created a BizTalk map and assign Source.xsd in SourceSchema and Destination.xsd in Destination schema of this map.You can see the snap of my Mapping as follows:
Here you can find that I have added just one script Functoids in the mapping of source and destination schema. I have written the following code (XSLT Code) to map both schemas.==========================================================================
<xsl:for-each select="//Order">
<xsl:element name="OrderInfo">
<xsl:element name="OrderID"><xsl:value-of select="Ord1" /></xsl:element>
<xsl:element name="OrderName"><xsl:value-of select="OrdName1" /></xsl:element>
</xsl:element>
</xsl:for-each>
<xsl:for-each select="//Order">
<xsl:element name="OrderInfo">
<xsl:element name="OrderID"><xsl:value-of select="Ord2" /></xsl:element>
<xsl:element name="OrderName"><xsl:value-of select="OrdName2" /></xsl:element>
</xsl:element>
</xsl:for-each>
==========================================================================So Test the map and check the generated destination file.Enjoy BizTalking:)
No comments:
Post a Comment