Equivalent to CSS CSS Multiple Selector

Is there any CSS selector (comma) in XPath, so I could find the select items, say //img and //*[@background] in the same query?

+4
source share
4 answers

XPath has the or ( | ) operator:

 //img|//*[@background] 
+9
source

Yes, this is a pipe ( | ).

 //img | //*[@background] 
+2
source

Use | for example: //img | //*[@background] //img | //*[@background]

+2
source

In addition to the "combined" operator | , which exists in XPath 1.0 and 2.0, there is also a comma operator in XPath 2.0 for forming a sequence of elements, for example //img, //*[@background] .

+2
source

All Articles