Although I like Mads solution: Here is another approach for XPath 2.0:
/bookstore/book[
tokenize(@class," ")="foo"
and not(tokenize(@class," ")="bar")
]
Please note that the following expressions are both true:
("foo","bar")="foo" -> true
("foo","bar")="bar" -> true