使用Biztalk 2010我有一个带有这种结构的传入消息:
<xml><blocks>
<block id="level">
<message id="code">100</message>
<message id="description">Some description</message>
</block>
<block id="level">
<message id="code">101</message>
<message id="description">More description</message>
</block>
</blocks>
<blocks>
<block id="change">
<message id="table">1</message>
<message id="oldvalue">100</message>
<message id="newvalue">101</message>
</block>
</blocks>
</xml>
我需要将上面的内容映射到这个结构:
<terms>
<termItem>
<code>100</code>
<description>Some description</description>
<deleted>false</deleted>
</termItem>
<termItem>
.....and so on with values from the above xml file, except that the item from the "change" block should be added as a new record to output, so the total output will be 3 items (<block>).
地图视图如下:
我需要一些帮助来选择使用functoid的正确组合,或者可能采用另一种方法来解决这一挑战。
我可以选择具有“级别”值的所有块并过滤掉“更改”块,但无法将两者组合在一起。
任何提示,建议都非常受欢迎。
由于
答案 0 :(得分:0)
似乎不仅仅满足了眼睛
也就是说,使用custom xslt instead of the visual mapper获得输出的一般结构相对简单。我假设您的图表中的RHS架构用于实际输出架构(而不是您的术语示例)。
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
exclude-result-prefixes="xsl xsi">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<!--Outer template-->
<xsl:template match="/">
<PaymentTerms CompanyCode="Unsure">
<xsl:apply-templates />
</PaymentTerms>
</xsl:template>
<!--Root blocks only-->
<xsl:template match="block[@id='level']">
<PaymentTerm>
<Code>
<xsl:value-of select="message[@id='code']/text()"/>
</Code>
<Description>
<xsl:value-of select="message[@id='description']/text()"/>
</Description>
<Deleted>
<!--No idea how you want this populated-->
<xsl:value-of select="'false'"/>
</Deleted>
</PaymentTerm>
<xsl:apply-templates select="blocks/block"></xsl:apply-templates>
</xsl:template>
<!--Nested blocks only-->
<xsl:template match="block[@id='change']">
<PaymentTerm>
<Code>
NestedCode
</Code>
<Description>
NestedDescription
</Description>
<Deleted>
NestedDeleted
</Deleted>
</PaymentTerm>
</xsl:template>
</xsl:stylesheet>
您没有提供有关如何映射嵌套块的详细信息,因此我在此期间提供了占位符。
HTH!