2

like this:

<p style="font-size: 12pt;">
  Hello world
  <span style="font-weight: bold;">just do it</span>
</p>

I want to remove every element's "style" attribute. I want the result like this:

<p>Hello world <span>just do it</span></p>

how to do this using hpricot?

thanks.


ok I have solved this like below:

doc = Hpricot("<p style='xxx'>are you ok?</p>")

doc.search("[@style]").each do |e|
  e.remove_attribute("style")
end
www
  • 4,065
  • 7
  • 30
  • 27

1 Answers1

4

Sometimes writing to stack overflow automatically solves your problems :) (my experience shows that to me)

Filip
  • 712
  • 1
  • 6
  • 14