更新时间:2022-06-22 10:26:19
通过用前导和尾随空格填充 @class
值,您可以测试foo"和bar"的存在不用担心它是第一个、中间的还是最后一个,以及对食物"或贫瘠"@class
值的任何误报:
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 '))]