By padding the @class
value with leading and trailing spaces, you can test for the presence of " foo " and " bar " and not worry about whether it was first, middle, or last, and any false positive hits on "food" or "barren" @class
values:
/bookstore/book[contains(concat(' ',@class,' '),' foo ')
and not(contains(concat(' ',@class,' '),' bar '))]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…