Biztalk 中缺少值时如何不映射元素?

发布于 2024-12-10 22:07:59 字数 60 浏览 1 评论 0原文

如果值丢失或者是空字符串,我不想在输出文档中写出元素属性。 怎么做呢? 这是在biztalk 地图中。

I don't want to in the output document to write out the element attribute if the value is missing or is an empty string.
How to do that?
That's in a biztalk mapping.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏了南城 2024-12-17 22:07:59

要抑制目标中的元素,请使用值映射 functoid。

  1. 将有问题的元素连接到LOGICAL EXISTENCE functoid。
  2. LOGICAL EXISTENCE functoid 连接到 LOGICAL AND functoid。
  3. 将元素 functoid 连接到 NOT EQUALS functoid。
  4. NOT EQUALS functoid 中,将 Condition2 设置为 BLANK。
  5. NOT EQUALS functoid 连接到 LOGICAL AND functoid。
  6. LOGICAL AND functoid 连接到 VALUE MAP functoid。
  7. 将元素连接到VALUE MAP functoid。
  8. VALUE MAP functoid 连接到目标元素。

按顺序执行这些步骤。下面的屏幕截图应该有所帮助:

sample map

HTH

To suppress an element in the destination, use a value mapping functoid.

  1. connect the element in question to a LOGICAL EXISTENCE functoid.
  2. connect the LOGICAL EXISTENCE functoid to a LOGICAL AND functoid.
  3. connect the element functoid to a NOT EQUALS functoid.
  4. In the NOT EQUALS functoid, set the Condition2 to BLANK.
  5. connect the NOT EQUALS functoid to the LOGICAL AND functoid.
  6. connect the LOGICAL AND functoid to the VALUE MAP functoid.
  7. connect the element to the VALUE MAP functoid.
  8. connect the VALUE MAP functoid to the destination element.

Do these steps in order. The screen shot below should help:

sample map

HTH

烟花易冷人易散 2024-12-17 22:07:59

如果您更喜欢自己执行 XSLT:
(我正在检查是否缺少元素、空值和 xsi:nil - 如果不适用,则相应删除)

<xsl:choose>
    <xsl:when test="not(s0:inElement) 
                    or s0:inElement[normalize-space(.) = ''] 
                    or string(s0:inElement/@xsi:nil) = 'true'">
        ... Default here, e.g. leave this blank, 
            ... or if you want nil then <ns1:outElement xsi:nil="true"/>
    </xsl:when>
    <xsl:otherwise>
        <ns1:outElement>
            <xsl:value-of select="s0:inElement/text()" />
        </ns1:outElement>
    </xsl:otherwise>
</xsl:choose>

If you prefer doing the XSLT yourself:
(I'm checking for missing element, empty value, and xsi:nil - delete accordingly if not applicable)

<xsl:choose>
    <xsl:when test="not(s0:inElement) 
                    or s0:inElement[normalize-space(.) = ''] 
                    or string(s0:inElement/@xsi:nil) = 'true'">
        ... Default here, e.g. leave this blank, 
            ... or if you want nil then <ns1:outElement xsi:nil="true"/>
    </xsl:when>
    <xsl:otherwise>
        <ns1:outElement>
            <xsl:value-of select="s0:inElement/text()" />
        </ns1:outElement>
    </xsl:otherwise>
</xsl:choose>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文