BizTalk Server General - Failing to flatten nodes in map.

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > December 2005 > Failing to flatten nodes in map.





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 Failing to flatten nodes in map.
Jesse

2005-12-20, 5:54 pm

I'm trying to map this type of structure:
<CommInfo>
<CommType>HomePhone</CommType>
<CommValue>555-1212</CommValue>
</CommInfo>
<CommInfo>
<CommType>WorkPhone</CommType>
<CommValue>555-9999</CommValue>
</CommInfo>


Into:
<Person>
<Name>Someone Special</Name>
<HomePhone>555-1212</HomePhone>
<WorkPhone>555-1212</WorkPhone>
</Person>


But cannot get it working with BizTalk 2004 SP0. Here is what I've tried
without success. Does anyone have any ideas? -- Thank you!
- If I use the Value Mapping functoid only the first one is coming through.
- If I use Cumulative Concatenation functoin into C# code to parse the
values, the map excepts because it does not allow Cumulative Concatenation
into a string parameter of C# code.
- I also tried two separate Scripting functoids with Inline XSD as suggested
here
<xsl:for-each select="//CommInfo">
<xsl:if test="CommType = 'HomePhone'">
<xsl:value-of select="CommValue"/>
</xsl:if>
</xsl:for-each>

<xsl:for-each select="//CommInfo">
<xsl:if test="CommType = 'WorkPhone'">
<xsl:value-of select="CommValue"/>
</xsl:if>
</xsl:for-each>



Greg Forsythe

2005-12-20, 5:54 pm

For the inline XSLT try this:

<xsl:for-each select="//CommInfo">
<xsl:if test="CommType = 'HomePhone'">
<xsl:element name = "HomePhone">
<xsl:value-of select="CommValue"/>
</xsl:element>
</xsl:if>
<xsl:if test="CommType = 'WorkPhone'">
<xsl:element name = "WorkPhone">
<xsl:value-of select="CommValue"/>
</xsl:element>
</xsl:if>
</xsl:for-each>

OR more generically

<xsl:for-each select="//CommInfo">
<xsl:variable name="var:v1" select="CommType" />
<xsl:element name="{$var:v1}">
<xsl:value-of select="CommValue"/>
</xsl:element>
</xsl:for-each>


Greg


"Jesse" <Jesse@discussions.microsoft.com> wrote in message
news:3A3E9156-D559-4744-B327-137237C9273E@microsoft.com...
> I'm trying to map this type of structure:
> <CommInfo>
> <CommType>HomePhone</CommType>
> <CommValue>555-1212</CommValue>
> </CommInfo>
> <CommInfo>
> <CommType>WorkPhone</CommType>
> <CommValue>555-9999</CommValue>
> </CommInfo>
>
>
> Into:
> <Person>
> <Name>Someone Special</Name>
> <HomePhone>555-1212</HomePhone>
> <WorkPhone>555-1212</WorkPhone>
> </Person>
>
>
> But cannot get it working with BizTalk 2004 SP0. Here is what I've tried
> without success. Does anyone have any ideas? -- Thank you!
> - If I use the Value Mapping functoid only the first one is coming
> through.
> - If I use Cumulative Concatenation functoin into C# code to parse the
> values, the map excepts because it does not allow Cumulative Concatenation
> into a string parameter of C# code.
> - I also tried two separate Scripting functoids with Inline XSD as
> suggested
> here
> <xsl:for-each select="//CommInfo">
> <xsl:if test="CommType = 'HomePhone'">
> <xsl:value-of select="CommValue"/>
> </xsl:if>
> </xsl:for-each>
>
> <xsl:for-each select="//CommInfo">
> <xsl:if test="CommType = 'WorkPhone'">
> <xsl:value-of select="CommValue"/>
> </xsl:if>
> </xsl:for-each>
>
>
>



Leonid Ganeline

2005-12-23, 2:49 am

You use not right functoid!
Use Value Mapping (Flattening) Functoid
look at
http://msdn.microsoft.com/library/d...oncept_qrof.asp
there is a good sample
--

Regards,

Leonid Ganeline
BizTalk Developer, MCSD
http://geekswithblogs.net/leonidganeline/
"Jesse" <Jesse@discussions.microsoft.com> wrote in message
news:3A3E9156-D559-4744-B327-137237C9273E@microsoft.com...
> I'm trying to map this type of structure:
> <CommInfo>
> <CommType>HomePhone</CommType>
> <CommValue>555-1212</CommValue>
> </CommInfo>
> <CommInfo>
> <CommType>WorkPhone</CommType>
> <CommValue>555-9999</CommValue>
> </CommInfo>
>
>
> Into:
> <Person>
> <Name>Someone Special</Name>
> <HomePhone>555-1212</HomePhone>
> <WorkPhone>555-1212</WorkPhone>
> </Person>
>
>
> But cannot get it working with BizTalk 2004 SP0. Here is what I've tried
> without success. Does anyone have any ideas? -- Thank you!
> - If I use the Value Mapping functoid only the first one is coming
> through.
> - If I use Cumulative Concatenation functoin into C# code to parse the
> values, the map excepts because it does not allow Cumulative Concatenation
> into a string parameter of C# code.
> - I also tried two separate Scripting functoids with Inline XSD as
> suggested
> here
> <xsl:for-each select="//CommInfo">
> <xsl:if test="CommType = 'HomePhone'">
> <xsl:value-of select="CommValue"/>
> </xsl:if>
> </xsl:for-each>
>
> <xsl:for-each select="//CommInfo">
> <xsl:if test="CommType = 'WorkPhone'">
> <xsl:value-of select="CommValue"/>
> </xsl:if>
> </xsl:for-each>
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com