我想选择所有h
标签,例如从标签h3
,即h3
, h4
, h5
...我知道如何仅选择h3
:
//h:h3
Use this:
//*[matches(name(), '^h\d')]
if there are namespaces in element name then use:
//*[matches(local-name(), '^h\d')]
Keep it simple and just enumerate them:
//*[self::h:h3 or self::h:h4 or self::h:h5 or self::h:h6]
You can use regex in various ways. For example...
For all tags of the form h
number :
//*[matches(local-name(),'^h\d+$')]
For a limited range of a single digit:
//*[matches(local-name(),'^h[3-6]$')]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.