BizTalk Mapping Challenge – Many To One Looping

BizTalk Server 2010 Mapping Challenge

Many to One Looping

Imagine that you have a scenario where in the source schema you have a structure with three records with the same elements, however the first record is unbounded while the sencond and the third one as only one occurance. Now you need to map this three records into one single record in the destination schema.

Example:

Source Schema Records:
– Vendor (Unbounded)
– Client (Occurs once)
– Owner (Occurs once)

Destination Schema:
– Participants (unbounded)

Check out my two solutions for this challenge bellow.

Here is the XSLT Code:


<Common>
<ID>
	<xsl:value-of select="//Personal/ID"/>
</ID>

<xsl:for-each select="Personal">
<!-- Process each vendor -->
<xsl:for-each select="Vendor">
	<xsl:variable name="fname" select="FName"/>
	<xsl:variable name="lname" select="LName"/>
	<xsl:variable name="addre" select="Address"/>
	<xsl:variable name="city" select="City"/>

	<Participant>
		<FName>
			<xsl:value-of select="$fname"/>
		</FName>
		<LName>
			<xsl:value-of select="$lname"/>
		</LName>
		<Address>
			<xsl:value-of select="$addre"/>
		</Address>
		<City>
			<xsl:value-of select="$city"/>
		</City>
	</Participant>
</xsl:for-each>
<!-- Process the client-->
<Participant>
	<FName>
		<xsl:value-of select="Customer/FName"/>
	</FName>
	<LName>
		<xsl:value-of select="Customer/LName"/>
	</LName>
	<Address>
		<xsl:value-of select="Customer/Address"/>
	</Address>
	<City>
		<xsl:value-of select="Customer/City"/>
	</City>
</Participant>
<!-- Process the owner -->
<Participant>
	<FName>
		<xsl:value-of select="Owner/FName"/>
	</FName>
	<LName>
		<xsl:value-of select="Owner/LName"/>
	</LName>
	<Address>
		<xsl:value-of select="Owner/Address"/>
	</Address>
	<City>
		<xsl:value-of select="Owner/City"/>
	</City>
</Participant>
</xsl:for-each>
</Common>

Anúncios

Deixe uma Resposta

Preencha os seus detalhes abaixo ou clique num ícone para iniciar sessão:

Logótipo da WordPress.com

Está a comentar usando a sua conta WordPress.com Terminar Sessão / Alterar )

Imagem do Twitter

Está a comentar usando a sua conta Twitter Terminar Sessão / Alterar )

Facebook photo

Está a comentar usando a sua conta Facebook Terminar Sessão / Alterar )

Google+ photo

Está a comentar usando a sua conta Google+ Terminar Sessão / Alterar )

Connecting to %s