<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t1="http://mynamespace/A" xmlns:top="http://mynamespace/B"
xmlns:max="http://mynamespace/C"><soapenv:Body>
<t1:Creditcard>
<top:AutoPayenroll>
<top:CustomerId>
<max:CustName>Taylor</max:CustName>
<max:CustID>1234</max:CustID>
</top:CustomerId>
</top:AutoPayenroll>
</t1:CreditCard></soapenv:Body></soapenv:Envelope>
需要将 CustID 更改为我所做的加密。但不知道如何插入
使用了这个 XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:t1="http://mynamespace/A" xmlns:top="http://mynamespace/B"
xmlns:max="http://mynamespace/C" version="1.0">
<xsl:output method="xml"/><xsl:template match="/">
<xsl:apply-templates/> </xsl:template> <xsl:template match="//*[local-name()='CustID']">
<xsl:variable name="cleartxt" select="./text()"/>
<!--got this encrypted data from my internal code-->
<xsl:variable name="encdata" select="'jksdguasidgeiruh'"/>
<xsl:element name="//*[local-name()='Pswd']">
<xsl:value-of select="$encdata"/>
</xsl:element> </xsl:template> <xsl:template match="*">
<xsl:copy> <xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy> </xsl:template> </xsl:stylesheet>
响应应该如下:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t1="http://mynamespace/A" xmlns:top="http://mynamespace/B" xmlns:max="http://mynamespace/C"><soapenv:Body>
<t1:Creditcard>
<top:AutoPayenroll>
<top:CustomerId>
<max:CustName>Taylor</max:CustName>
<max:CustID>jksdguasidgeiruh</max:CustID>
</top:CustomerId>
</top:AutoPayenroll>
</t1:CreditCard></soapenv:Body></soapenv:Envelope>