P
P
paulszgr2016-11-13 21:53:35
XPath
paulszgr, 2016-11-13 21:53:35

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

Hello, can you please tell me how to get all style attributes except those that belong to the tbody tag using XPATH?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya, 2016-11-13
@glebovgin

Good afternoon.
There is an option without language binding:
After that, you can simply access 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 we talk only about php, then there is also this option:
$res = $xpath->query('//*[not(name() = "tbody")]');
foreach ($res as $r)
  echo $r->getAttribute('style');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question