btm映射异常 - 无法将属性和命名空间节点添加到父元素

时间:2018-02-01 17:39:43

标签: xml xslt biztalk-mapper

btm mapping file我做了custom body mapping,如下所示transformation xslt gives below error -

  

无法将属性和命名空间节点添加到父元素   在添加了text,comment,pi或子元素节点之后

xslt mapping -

    <DemoParent>
 <IdRef>
                <xsl:attribute name="identifier">
                  <xsl:value-of select="header/msgHeader/Number/text()" />
                </xsl:attribute>
                <xsl:attribute name="identifier">
                  <xsl:value-of select="header/msgHeader/customerNumber/text()" />
                </xsl:attribute>

              </IdRef>
              <xsl:attribute name="name">
                <xsl:value-of select="$var:v12" />
              </xsl:attribute>
              <xsl:element name="TEST">
            <xsl:copy-of select="//*[local-name()='DEMO1' and namespace-uri()='']/*[local-name()='header' and namespace-uri()='']/*[local-name()='msgHeader' and namespace-uri()='']/*[local-name()='sale' and namespace-uri()='']/*" />
     </xsl:element>
            </DemoParent>
为自定义映射添加了

<xsl:element name="TEST">

1 个答案:

答案 0 :(得分:1)

The rule is that instructions that add attributes to an element must appear before/above instructions that add child nodes to the same element. (The error message talks in terms of order of execution, which is a polite fiction).

In your edited post we can see that for DemoParent, the instruction to create an IdRef child element appears above the xsl:attribute instruction that creates the name attribute; it needs to be moved so the attribute comes first.