我有以下 XML
<response>
<Contacts>
<Contact>
<Name>John Doe</Name>
<Age>48</Age>
<DOB>
<Day>12</Day>
<Month>6</Month>
<Year>1964</Year>
</DOB>
<Contacts>
<Contact>
<Name>Jane Walsh</Name>
<Age>30</Age>
<DOB>
<Day>24</Day>
<Month>3</Month>
<Year>1983</Year>
</DOB>
</Contact>
<Contact>
<Name>Rob Marsh</Name>
<Age>55</Age>
<DOB>
<Day>1</Day>
<Month>Feb</Month>
<Year>1958</Year>
</DOB>
</Contact>
</Contacts>
</Contact>
</Contacts>
</response>
我正在使用身份转换将结构复制到目标。
<xsl:template name = "testTemplate" match="/*[local-name()='response']/*">
<xsl:apply-templates mode="copy-no-ns" select="response"/>
</xsl:template>
<!-- Selectively mass copy some of the nodes without namespaces -->
<xsl:template mode="copy-no-ns" match="*">
<xsl:element name="{name(.)}" namespace="{namespace-uri(.)}">
<xsl:copy-of select="@*"/>
<xsl:apply-templates mode="copy-no-ns" select="node()"/>
</xsl:element>
</xsl:template>
XSL 在 Altova XMLSpy 中工作,当我使用 Visual Studio 2010 对其进行测试时,它也会产生所需的输出。但是 BizTalk 映射会产生如下的空节点(删除了正确复制的其他内容)。
<Contacts>
<Contact>
<Contacts>
<Contact />
<Contact />
</Contacts>
<Contact>
</Contacts>
我不知道发生了什么以及如何解决这个问题。有什么建议么?万分感谢