count(/log/logentry[ ./paths/path/text() contains text "trunk" and not( (./paths/path/text() contains text "tags") or (./paths/path/text() contains text "branches") ) ])
what about
let $trunk := /log/logentry[ paths/path/text() contains text "trunk"], $tags := /log/logentry[ paths/path/text() contains text "tags"], $branches := /log/logentry[ paths/path/text() contains text "branches"]
return $trunk except ($tags|$branches)