I have the following XPath expression written in Java:

`" pProbs = XPath.newInstance(/n-grams-sorted/n-gram[contains(.,"+content1+") or contains(.,"+content2+") or contains(.,"+content3+") or contains(.,"+content4+") or contains(.,"+content5+")]/@probability");`

My problem is that not all of the contains() expressions return true. What I need is:

If one of them returns 'false' (i.e.: there are no nodes containing pattern 'x y z'), then Java must output a '0'. Seems simple enough, but I can't come up with a solution for this.

Any ideas?

Thanks