views:

61

answers:

2

Example:

Say for instance you had the following two tags some where in a legacy page you've been assigned to work on:

    <table style="padding:0px; margin:0px; border: 0px; width:100%;">

    <td style="width:100%; margin:0px; padding:0px;  border: 0px;">

Would there be a program that could make a list of these random style tags and re-arrange their contents perhaps ordering the css within the tags in alphabetical order:

    <table style="border: 0px; margin:0px; padding:0px; width:100%;">

    <td style="border: 0px; margin:0px; padding:0px; width:100%;">

Finally the tool would compare these these two style strings see that they are alike (when arranged alphabetically)...

    <table class="style1">

    <td class="style1">

...and assign a class both the tags and create a css entry:

    .style1 {
       border: 0px; 
       margin:0px; 
       padding:0px; 
       width:100%;
    }

...are there any existing tools/utilities/scripts for this?

A: 

Well, I don't know if there is a tool directly out there. There probably is. However if you had to do it yourself you could do it with XSLT. You could write a stylesheet to parse your html document and pull out the style attribute, dump it to a class value and add the class attribute.

Joshua Cauble
+1  A: 

Dreamweaver can do this

http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WS8BC8A54F-60BC-40bd-A368-50A405C51350a.html

metal-gear-solid
Yeah, but you have to do that for pretty much every single style attribute in the entire page. (right?)
leeand00