我正在尝试将 Soap 标头添加到我的文档中并更新第一个 RS 节点
<Rs xmlns="http://tempuri.org/schemas">
同时复制其余的文档节点。在我的真实示例中,我将在 RS 父节点中有更多节点,因此我正在寻找具有某种深层副本的解决方案。
<-- this is the data which needs transforming -->
<Rs>
<ID>934</ID>
<Dt>995116</Dt>
<Date>090717180408</Date>
<Code>9349</Code>
<Status>000</Status>
</Rs>
<-- Desired Result -->
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<Rs xmlns="http://tempuri.org/schemas">
<ID>934</ID>
<Dt>090717180408</Dt>
<Code>9349</Code>
<Status>000</Status>
</Rs>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<-- this is my StyleSheet. it's not well formed so i can't exexute it-->
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="xml" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<xsl:apply-templates select = "Rs">
</xsl:apply-templates>
<xsl:copy-of select="*"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
</xsl:template>
<xsl:template match ="Rs">
<Rs xmlns="http://tempuri.org/schemas">
</xsl:template>
</xsl:stylesheet>
我一直在阅读教程,但在了解模板以及在哪里实现它们时遇到了麻烦。