Beefy Boxes and Bandwidth Generously Provided by pair Networks
Frank P is for Practical  "combined" HTML *and* CSS parser?  by
telcontar (Beadle) on Apr 12, 2005 at 19:05 UTC
( #447136=perlquestion: print w/ replies, xml ) Need Help??
Dear Monks,  let me see if I can explain this in a satisfactory
way.  I have been using HTML::Tree to parse HTML documents, and
I could use some CSS parser to parse CSS files (or statements).
But how do I put them in context- use them together? This will
give me two parse trees, but what I'd rather have is a single
tree where I can access CSS properties at the level of HTML
elements.  For instance, if I have a simple CSS rule, and I get
a parse tree out of it, how am I to know which HTML elements it
will apply to? This depends on the property (since some
properties have no rendering effect on some types of elements),
on inheritance, etc.  In short, is there any way to combine some
HTML and CSS browsers so that, in the HTML parse tree, one can
tell which elements effectively hav