埃德:从下面复制并行元素作为另一个元素的子元素 :
输入XML
<root>
<order orderId="12345">
<cartId>12346</cartId>
<orderPayment paymentId="1234">
<debitCardPayment>
<chargeAmount currencyCode="USD">22.20</chargeAmount>
<debitCard>
<PIN>1234</PIN>
<PIN1></PIN1>
</debitCard>
</debitCardPayment>
</orderPayment>
</order>
<context>
</context>
</root>
需要OUTPUT
<order>
.....
</order>
<orderPayment>
.....
<debitCard>
<PIN>1234</PIN>
</debitCard>
</orderPayment>
<context>
</context>
我有XSLT如下
<xsl:template match="Root">
<updateOrderCheckoutRequest version="1">
<xsl:apply-templates select="@*|node()"/>
<xsl:copy-of select="//orderPayment"/>
</updateOrderCheckoutRequest>
</xsl:template>
<xsl:template match="orderPayment"/>
<xsl:template match="order">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:choose>
<xsl:when test=".='' and count(@*)=0">
<xsl:apply-templates select="@*|node()"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
这也是抄袭空元素。 是否有可能删除,而应用复制的空元素。 提前致谢...