Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XSLT从SOAP请求中获取属性值_Xslt_Soap_Ibm Datapower - Fatal编程技术网

XSLT从SOAP请求中获取属性值

XSLT从SOAP请求中获取属性值,xslt,soap,ibm-datapower,Xslt,Soap,Ibm Datapower,我有以下SOAP请求,需要在XSLT模板中提取IP地址参数值 SOAP请求: <soapenv:Envelope xmlns:ws="http://diamondip.com/ipcontrol/ws/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche

我有以下SOAP请求,需要在XSLT模板中提取IP地址参数值

SOAP请求:

<soapenv:Envelope
xmlns:ws="http://diamondip.com/ipcontrol/ws/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
<soapenv:Header />
<soapenv:Body>
<ws:deleteDevice soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<inpDev xsi:type="ser:WSDevice"
xmlns:ser="http://service.ipcontrol.diamondip.com"
>
<ipAddress xsi:type="soapenc:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
>xxx.xxx.xx.xx</ipAddress>
</inpDev>
</ws:deleteDevice>
</soapenv:Body>
</soapenv:Envelope>

xxx.xxx.xx.xx
我尝试使用以下方法获取值,但没有成功

<xsl:variable name="ipAddress" select="soapenv:Envelope/soapenv:Body/ws:deleteDevice/inpDev/ipAddress/text()"/>


谢谢你的建议

从您的问题中我们不知道的一件事是,当您执行xsl:变量时,当前上下文节点是什么。如果当前上下文节点是根节点,则它应该可以工作


尝试将XPath更改为绝对路径(在开头放一个正斜杠)。如果这不起作用,请确保在XSLT中正确定义了所有名称空间。

您可以使用下面的代码导航并获取输出

<xsl:stylesheet version ="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match ='/'>
<xsl:variable name="ipAddress" select="/*[local-name() = 'Envelope']/*[local-name() = 'Body']/*[local-name() = 'deleteDevice']/*[local-name() = 'inpDev']/*[local-name() = 'ipAddress']/text()"/>
IP Adress: <xsl:value-of select = "$ipAddress"/>
</xsl:template>
</xsl:stylesheet>

IP地址:

请显示所有XSLT代码,并解释哪些代码不起作用。