07-01-04 10:52 PM
You have to use scripting functoid and write XSLT Template.
Let me know if you need help with that.
Thanks
Tatyana
--------------------
>From: "Eric Theil" <etheil@3tsystems.com>
>Subject: Multiple elements to single element (Biztalk Mapper)
>Date: Tue, 23 Dec 2003 12:34:32 -0700
>Lines: 70
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <eMH6JvYyDHA.3416@tk2msftngp13.phx.gbl>
>Newsgroups: microsoft.public.biztalk.tools
>NNTP-Posting-Host: 64.78.180.122
>Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msf
tngp13.phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.biztalk.tools:3242
>X-Tomcat-NG: microsoft.public.biztalk.tools
>
>I'm trying to figure out a way to go from a collection of types and map tha
t
>into a flat type. Here's the example:
>
>Input:
><DexRaces>
> <DexRace>
> <Code>1</Code>
> </DexRace>
> <DexRace>
> <Code>3</Code>
> </DexRace>
></DexRace>
>
>Desired Output:
><Monitoring>
> <Race1>true</Race1><!-- Inserted if the above Code value is 1 -->
> <Race2>false</Race2><!-- Inserted if the above Code value is 2 -->
> <Race3>true</Race3><!-- Inserted if the above Code value is 3 -->
> <Race4>false</Race4><!-- Inserted if the above Code value is 4 -->
> <Race5>false</Race5><!-- Inserted if the above Code value is 5 -->
></Monitoring>
>
>There can only be a single <DexRaces> element within the source, but
>multiple <DexRace> elements. The problem I'm running into with the Biztalk
>Mapper is that I need a way to loop through the <DexRace> elements, get the
><Code> value and then insert "true" or "false" into the corresponding
><Race[n]> element. When I use any of the functiods, the resulting xslt
code
>loops through the <DexRace> elements for each <Race[n]> element, like t
his:
>
> <xsl:for-each select="DexRace">
> <xsl:variable name="var:v141"
>select="userJScript:CompareValues201("1",string(Code/text()))"/>
> <xsl:if test="string($var:v141)="true"">
> <xsl:variable name="var:v142" select=""true""/>
> <Race1><xsl:value-of select="$var:v142"/></Race1>
> </xsl:if>
> </xsl:for-each>
> <xsl:for-each select="DexRace">
> <xsl:variable name="var:v143"
>select="userJScript:CompareValues201("2",string(Code/text()))"/>
> <xsl:if test="string($var:v143)="true"">
> <xsl:variable name="var:v144" select=""true""/>
> <Race2><xsl:value-of select="$var:v144"/></Race2>
> </xsl:if>
> </xsl:for-each>
>
>I need something like this:
>
> <xsl:for-each select="DexRaces/DexRace">
> <xsl:choose>
> <xsl:when test="Code=1">
> <Race1>true</Race1>
> </xsl:when>
> <xsl:when test="Code=2">
> <Race2>true</Race2>
> </xsl:when>
> <...>
> </xsl:choose>
> </xsl:for-each>
>
>I'd do this manually, but we have too many existing mappings within the fil
e
>and need to continue to use the Mapper. If I add the code, it's wiped out
>when I save the map. Any suggestions?
>
>Thanks,
>
>Eric
>
>
>
>
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this mess
age are best directed to the newsgroup/thread from which they originated.
[ Post a follow-up to this message ]
|