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

后端 未结 10 2142
一整个雨季
一整个雨季 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:55

    EDIT: see bobince's solution which uses contains rather than start-with, along with a trick to ensure the comparison is done at the level of a complete token (lest the 'atag' pattern be found as part of another 'tag').

    "atag btag" is an odd value for the class attribute, but never the less, try:

    //*[starts-with(@class,"atag")]
    

提交回复
热议问题