I have this XML
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/12.1X46/junos">
<environment-information xmlns="http://xml.juniper.net/junos/12.1X46/junos-chassis">
<environment-item>
<name>Routing Engine</name>
<class>Temp</class>
<status>Failed</status>
<temperature junos:celsius="50">50 degrees C / 122 degrees F</temperature>
</environment-item>
<environment-item>
<name>Routing Engine CPU</name>
<status>Absent</status>
</environment-item>
<environment-item>
<name>Power Supply 0</name>
<class>Power</class>
<status>OK</status>
</environment-item>
<environment-item>
<name>Power Supply 1</name>
<class>Power</class>
<status>Absent</status>
</environment-item>
</environment-information>
<cli>
<banner></banner>
</cli>
</rpc-reply>
I want to show all "environment-item" that does not have status = "Absent".
I have tried many sites to test XPATH on, but have failed to come up with an answer. The way I figured it would be was /rpc-reply/environment-information/*[not(contains(status, 'Absent'))]
, or /rpc-reply/environment-information[1]/*[not(contains(status, 'Absent'))]
but it's not working.
Two questions:
- What's wrong with my XPATH?
- Is there a reliable site to test it on? I have gone through the first three pages on google, but since I can't get the XPATH to work on any of them I have a hard time to evaluate them.
Thankful for any explanations. Would rather get a fishing rod than a fish, if I have to choose! :)
Kind regards, Patrik