Figure 1. Bad solution map
<?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 s0 ScriptNS0" version="1.0" xmlns:ns0="http://Biztalk.Mapping.GlobalVariable.Destination" xmlns:s0="http://Biztalk.Mapping.GlobalVariable.Source" xmlns:ScriptNS0="http://schemas.microsoft.com/BizTalk/2003/ScriptNS0"> <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" /> <xsl:template match="/"> <xsl:apply-templates select="/s0:Source" /> </xsl:template> <xsl:template match="/s0:Source"> <ns0:Destiation> <xsl:for-each select="SourceRepeatedRecords"> <DestinationRepeatedRecords> <xsl:variable name="var:v1" select="ScriptNS0:GetLookupValue(string(../Key/text()))" /> <Value> <xsl:value-of select="$var:v1" /> </Value> <FieldA> <xsl:value-of select="FieldA/text()" /> </FieldA> <FieldB> <xsl:value-of select="FieldB/text()" /> </FieldB> </DestinationRepeatedRecords> </xsl:for-each> </ns0:Destiation> </xsl:template> </xsl:stylesheet>
<?
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 s0 ScriptNS0"
xmlns:ns0
"http://Biztalk.Mapping.GlobalVariable.Destination"
xmlns:s0
"http://Biztalk.Mapping.GlobalVariable.Source"
xmlns:ScriptNS0
"http://schemas.microsoft.com/BizTalk/2003/ScriptNS0"
>
xsl:output
omit-xml-declaration
"yes"
method
"xml"
/>
xsl:template
match
"/"
xsl:apply-templates
select
"/s0:Source"
</
ns0:Destiation
xsl:for-each
"SourceRepeatedRecords"
DestinationRepeatedRecords
xsl:variable
name
"var:v1"
"ScriptNS0:GetLookupValue(string(../Key/text()))"
Value
xsl:value-of
"$var:v1"
FieldA
"FieldA/text()"
FieldB
"FieldB/text()"
Figure 2. XSL file of bad solution map
Figure 3. Debug View Event logs output for bad solution
Figure 4. Good Solution Map
Figure 5. Setting DB value in global variable
Figure 6. Get the value from a global variable
Figure 7. Debug View Event logs output for bad solution