How to get all style attributes except those that belong to the tbody tag?

Hello, please tell me how to use XPATH to get all style attributes except those that belong to the tbody tag?

Thanks in advance.
July 2nd 19 at 17:11
1 answer
July 2nd 19 at 17:13
Good day.

There is a variant without reference to the language:
//*[not(name() = "tbody")]/@style
Then you can just access the nodeValue, if we talk about php, it will look like this:
$res = $xpath->query('//*[not(name() = "tbody")]/@style');
foreach ($res as $r)
 echo $r->nodeValue;


If you only talk about php, then there is also this option:
$res = $xpath->query('//*[not(name() = "tbody")]');
foreach ($res as $r)
 echo $r->getAttribute('style');

Find more questions by tags XPath