BizTalk Server General - Mapping many records to one flat record - complement

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > January 2005 > Mapping many records to one flat record - complement





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Mapping many records to one flat record - complement
Peter

2005-01-31, 7:47 am

Hi, the compiled mapping file (XSL) looks like:

<Message>
<R01>
<xsl:for-each select="Group">
<xsl:variable name="var:v1"
select="userVBScript:fctequal(string(H01/@Field1),"A")"/>
<xsl:if test="string($var:v1)="true"">
<xsl:variable name="var:v2" select="H01/@Field2"/>
<xsl:attribute name="Field1"><xsl:value-of
select="$var:v2"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Group">
<xsl:variable name="var:v3"
select="userVBScript:fctequal(string(H01/@Field1),"B")"/>
<xsl:if test="string($var:v3)="true"">
<xsl:variable name="var:v4" select="H01/@Field2"/>
<xsl:attribute name="Field2"><xsl:value-of
select="$var:v4"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Group">
<xsl:variable name="var:v5"
select="userVBScript:fctequal(string(H02/@Field3),"C")"/>
<xsl:if test="string($var:v5)="true"">
<xsl:variable name="var:v6" select="H02/@Field4"/>
<xsl:attribute name="Field3"><xsl:value-of
select="$var:v6"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Group">
<xsl:variable name="var:v7"
select="userVBScript:fctequal(string(H02/@Field3),"D")"/>
<xsl:if test="string($var:v7)="true"">
<xsl:variable name="var:v8" select="H02/@Field4"/>
<xsl:attribute name="Field4"><xsl:value-of
select="$var:v8"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Group">
<xsl:variable name="var:v9"
select="userVBScript:fctequal(string(H01/@Field1),"E")"/>
<xsl:if test="string($var:v9)="true"">
<xsl:variable name="var:v10" select="H01/@Field2"/>
<xsl:attribute name="Field5"><xsl:value-of
select="$var:v10"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Group">
<xsl:variable name="var:v11"
select="userVBScript:fctequal(string(H02/@Field3),"F")"/>
<xsl:if test="string($var:v11)="true"">
<xsl:variable name="var:v12" select="H02/@Field4"/>
<xsl:attribute name="Field6"><xsl:value-of
select="$var:v12"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
</R01>
</Message>


.... but it should maybe look like this:


<Message>
<xsl:for-each select="Group">
<R01>
<xsl:for-each select="H01">
<xsl:variable name="var:v1"
select="userVBScript:fctequal(string(H01/@Field1),"A")"/>
<xsl:if test="string($var:v1)="true"">
<xsl:variable name="var:v2" select="H01/@Field2"/>
<xsl:attribute name="Field1"><xsl:value-of
select="$var:v2"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="H01">
<xsl:variable name="var:v3"
select="userVBScript:fctequal(string(H01/@Field1),"B")"/>
<xsl:if test="string($var:v3)="true"">
<xsl:variable name="var:v4" select="H01/@Field2"/>
<xsl:attribute name="Field2"><xsl:value-of
select="$var:v4"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="H02">
<xsl:variable name="var:v5"
select="userVBScript:fctequal(string(H02/@Field3),"C")"/>
<xsl:if test="string($var:v5)="true"">
<xsl:variable name="var:v6" select="H02/@Field4"/>
<xsl:attribute name="Field3"><xsl:value-of
select="$var:v6"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="H02">
<xsl:variable name="var:v7"
select="userVBScript:fctequal(string(H02/@Field3),"D")"/>
<xsl:if test="string($var:v7)="true"">
<xsl:variable name="var:v8" select="H02/@Field4"/>
<xsl:attribute name="Field4"><xsl:value-of
select="$var:v8"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="H01">
<xsl:variable name="var:v9"
select="userVBScript:fctequal(string(H01/@Field1),"E")"/>
<xsl:if test="string($var:v9)="true"">
<xsl:variable name="var:v10" select="H01/@Field2"/>
<xsl:attribute name="Field5"><xsl:value-of
select="$var:v10"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="H02">
<xsl:variable name="var:v11"
select="userVBScript:fctequal(string(H02/@Field3),"F")"/>
<xsl:if test="string($var:v11)="true"">
<xsl:variable name="var:v12" select="H02/@Field4"/>
<xsl:attribute name="Field6"><xsl:value-of
select="$var:v12"/></xsl:attribute>
</xsl:if>
</xsl:for-each>
</R01>
</xsl:for-each>
</Message>

/Peter
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com