I am looking for a faster way to grab contents with xpath.
I read this post:
Selecting a css class with xpath
put the first responses "class" selector in my project, as..
//*[contains(concat(" ", normalize-space(@class), " "), " attr-price ")]
which works great. It returns to me all the elements with the class "attr-price", and I can even do something like a compound selector by doing..
//*[contains(concat(" ", normalize-space(@class), " "), " attr-price second-class")]
However, the part of this I do not like is the //*. This makes XPath go through all nodes, and is decreasing my sites performance pretty significantly. I read on W3schools about the different types of selectors and have tried using / and // instead of //*, however none of these work. The attr-price elements are all within a <ul>
would like to do something analagous to..
/ul/[contains(concat(" ", normalize-space(@class), " "), " attr-price ")]
this way I am hitting each of the UL's instead of every single element, and then searching for my class there, kind of like if I was using jQuery's
$('ul').find('.attr-price')
Any input is appreciated, thank you.