On extracting an element from a web page with CSS styles
nathancahill.wordpress.com
nathancahill.wordpress.com
Also, you don't need to copy every child element's style. You only need to copy the styles that are different from the parent element and/or different from your current stylesheet.
For each element, I believe you can create an empty one in the place you'll be putting the final output to see what its computed styles are, and then use that to compare to the one you're reading from.