-1

I have the following SOAP Request and i need to extract the IP Address parameter value inside the XSLT template.

SOAP REQUEST:

<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>

I tried using the following to get the value,but it didn't work

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

Appreciate any advise!

ajithparamban
  • 2,833
  • 3
  • 17
  • 14

2 Answers2

0

The one thing we don't know from your question is what the current context node is when you do the xsl:variable. It should work if your current context node is the root node.

Try changing the XPath to an absolute path (put a forward slash at the beginning). If that doesn't work, make sure all the namespaces are defined correctly in your XSLT.

bjimba
  • 928
  • 8
  • 13
-1

You can use below code to navigate and get the output.

<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>
sreevathsa a
  • 149
  • 13