Biztalk中缺少值时如何不映射元素?
如果缺少值或是空字符串,我不希望在输出文档中写出element属性。 怎么做?Biztalk中缺少值时如何不映射元素?,biztalk,Biztalk,如果缺少值或是空字符串,我不希望在输出文档中写出element属性。 怎么做? 这在biztalk映射中 要抑制目标中的元素,请使用“值映射”functoid 将相关元素连接到逻辑存在functoid 将逻辑存在functoid连接到逻辑与functoid 将元素functoid连接到不等于functoid 在NOT EQUALSfunctoid中,将条件2设置为空白 将NOT EQUALSfunctoid连接到逻辑ANDfunctoid 将逻辑与functoid连接到值映射functoid 将
这在biztalk映射中 要抑制目标中的元素,请使用“值映射”functoid
逻辑存在
functoid李>
逻辑存在
functoid连接到逻辑与
functoid李>
不等于functoid李>
在NOT EQUALS
functoid中,将条件2设置为空白李>
将NOT EQUALS
functoid连接到逻辑AND
functoid李>
将逻辑与
functoid连接到值映射
functoid李>
将元素连接到值映射
functoid李>
将值映射
functoid连接到目标元素
按顺序执行这些步骤。下面的屏幕截图应有助于:
HTH如果您喜欢自己做XSLT:
(我正在检查缺少的元素、空值和xsi:nil
-如果不适用,请相应删除)
... 此处为默认值,例如,将此项留空,
... 或者如果你想要零呢
xslt解决方案看起来不错。看看这里,看看如何将可视映射转换为xslt,我通常只使用>functoid,并比较它是否大于单个空格。然后你有一个逻辑functoid而不是3个。
<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>