Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Functoid › Re: Functoid
December 13, 2006 at 1:07 AM
#16866
Well Siva as per my understanding you need to use a custom XSLT in your MAP.I tried it in the test environment and here are the results.
Input File:
<Detail>
<Detail01>
<POId> 552233 </POId>
<PartnerId> IBM_Lenovo </PartnerId>
<Detail02>
<Msg> PC – Dul Core</Msg>
</Detail02>
<Detail02>
<Msg> 250GB Hardrive, 2G Mem </Msg>
</Detail02>
</Detail01>
<Detail01>
<POId> 552235 </POId>
<PartnerId> CISCO </PartnerId>
<Detail02>
<Msg> Network Card</Msg>
</Detail02>
<Detail02>
<Msg> Via Purelator Please</Msg>
</Detail02>
</Detail01>
</Detail>
Output File:
<RootNodeOutput>
<POID>552233</POID>
<MSG>PC – Dul Core 250GB Hardrive, 2G Mem</MSG>
</Detail>
<POID>552235</POID>
<MSG>Network Card Via Purelator Please</MSG>
</Detail>
</RootNodeOutput>
———————————————————————
XSLT Used:
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" >
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/Detail" />
</xsl:template>
<xsl:template match="/Detail">
<RootNodeOutput>
<xsl:for-each select="Detail01">
<Detail>
<xsl:variable name="tempMSG">
<xsl:for-each select="Detail02">
<xsl:value-of select="Msg/text()" />
</xsl:for-each>
</xsl:variable>
<POID>
<xsl:value-of select="POId/text()" />
</POID>
<MSG>
<xsl:value-of select="$tempMSG" />
</MSG>
</Detail>
</xsl:for-each>
</RootNodeOutput>
</xsl:template>
</xsl:stylesheet>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" exclude-result-prefixes="msxsl var" version="1.0" >
<xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/Detail" />
</xsl:template>
<xsl:template match="/Detail">
<RootNodeOutput>
<xsl:for-each select="Detail01">
<Detail>
<xsl:variable name="tempMSG">
<xsl:for-each select="Detail02">
<xsl:value-of select="Msg/text()" />
</xsl:for-each>
</xsl:variable>
<POID>
<xsl:value-of select="POId/text()" />
</POID>
<MSG>
<xsl:value-of select="$tempMSG" />
</MSG>
</Detail>
</xsl:for-each>
</RootNodeOutput>
</xsl:template>
</xsl:stylesheet>
Hope you find it Useful.