Reputation: 565
can someone explain to me why this condition return false in this following xpath query
xml
<?xml version="1.0" encoding="UTF-8"?> <a>ha</a>
xpath query
count(//a) return 1.
but
test="(count(//a) > 0)" return false?
Thank you
Upvotes: 0
Views: 410
Reputation: 163342
In the query
test="(count(//a) > 0)"
test
refers to a child element of the document node called "test". If there is no such element (which is the case here), then you are comparing an empty set to the string "count(//a) > 0". Comparing an empty set to anything returns false.
Upvotes: 2
Reputation: 20620
Maybe you don't need the "" marks.
From the free tool XPathBuilder:
http://www.bubasoft.net/product/xpath-builder/
Upvotes: 1