How can I match on an attribute that contains a certain string?

后端 未结 10 2204
一整个雨季
一整个雨季 2020-11-22 03:14

I am having a problem selecting nodes by attribute when the attributes contains more than one word. For example:

10条回答
  •  我寻月下人不归
    2020-11-22 03:46

    A 2.0 XPath that works:

    //*[tokenize(@class,'\s+')='atag']
    

    or with a variable:

    //*[tokenize(@class,'\s+')=$classname]
    

提交回复
热议问题