AnsweredAssumed Answered

Conditional XPath Query

Question asked by MallikarjunMelagiri on Nov 27, 2015
Latest reply on Nov 30, 2015 by MallikarjunMelagiri

Hi all,

 

I have a webservice response as follows:

<soapenv:Envelope 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:Body>

        <getProductAvailabilityResponse xmlns="http://my.stream.project.org.com">

            <getProductAvailabilityReturn>

                <modelNbr>AABBCC</modelNbr>

                <onHandQty>0</onHandQty>

            </getProductAvailabilityReturn>

            <getProductAvailabilityReturn>

                <modelNbr>PPQQRR</modelNbr>

                <onHandQty>93</onHandQty>

            </getProductAvailabilityReturn>

            <getProductAvailabilityReturn>

                <modelNbr>XXYYZZ</modelNbr>

                <onHandQty>53</onHandQty>

            </getProductAvailabilityReturn>

        </getProductAvailabilityResponse>

    </soapenv:Body>

</soapenv:Envelope>

 

How do I write an XML XPath filter to get the value of ModelNbr, for the first getProductAvailabilityReturn whose onHandQty is a non-zero value?

 

I tried various things and am unable to get it at all.

 

Even //:getProductAvailabilityReturn[onHandQty>0]  is not returning anything.

Outcomes