0
我一直在努力改造SOAP響應,根據我的知識,我已經試過許多方法,下面是我寫的XML和XSL,我似乎無法得到任何節點的值。XSLT轉換
下面是XML:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<CreateCallResponse xmlns="http://tempuri.org/">
<CreateCallResult xmlns:a="http://schemas.datacontract.org/2004/07/ServiceCallCreate" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<a:ParameterList>
<a:Paramname>errorstate</a:Paramname>
<a:ParamValue>0</a:ParamValue>
</a:ParameterList>
<a:ParameterList>
<a:Paramname>errorstring</a:Paramname>
<a:ParamValue/>
</a:ParameterList>
<a:ParameterList>
<a:Paramname>newcallid</a:Paramname>
<a:ParamValue>160901-0083</a:ParamValue>
</a:ParameterList>
</CreateCallResult>
</CreateCallResponse>
</s:Body>
</s:Envelope>
下面是XSL:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope"
xmlns:a="http://schemas.datacontract.org/2004/07/ServiceCallCreate"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:k="http://tempuri.org" exclude-result-prefixes="s k i a">
<xsl:output method="xml" omit-xml-declaration="yes" encoding="utf-8" indent="yes" />
<xsl:template match="/">
<CreateCallResponse>
<ErrorCode>
<xsl:value-of select="s:Envelope/s:Body/k:CreateCallResponse/i:CreateCallResult/a:ParameterList/a:ParamValue" />
</ErrorCode>
</CreateCallResponse>
</xsl:template>
</xsl:stylesheet>
請幫我在哪裏我也做了錯誤。
我也試過這個,但沒有得到任何價值。從我的理解上面的xpath應該給我帶來第一個paramValue – joga
你的代碼中有另一個不正確的URI。 –
謝謝,它工作:) – joga