XPath expressions like .[true()]
are actually illegal (at least in XPath 1.0). Predicates are only allowed
- in location steps after a NodeTest but not after an AbbreviatedStep like
.
- after a FilterExpr or PrimaryExpr but not after any other expression
You should simply follow @Ross Patterson's suggestion and write //a[@class='inline-object' and contains(@href,'test.com')]
. Or, alternatively but more convoluted:
self::node()[contains(@href,'test.com')]
orself::*[contains(@href,'test.com')]
or(.)[contains(@href,'test.com')]