tags:

views:

85

answers:

1

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
+1  A: 

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

Filip
yes!!!! I like stackoverflow very much!
www