title: How to apply CSS to XML in python?
body: <p>I have an xml file that would I would like to parse (E.g. using lxml.etree) apply a set of css styles to, and then export.  For instance, the input would be this xml:</p>
  
  <pre><code>&lt;root&gt;
    &lt;foo id="good"&gt;
      &lt;bar class="bad"&gt;
      &lt;/bar&gt;
    &lt;/foo&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>and this css:</p>
  
  <pre><code>bar {
     color:red
  }
  
  #good {
     color: green
  }
  </code></pre>
  
  <p>and the resulting XML would look something like:</p>
  
  <pre><code>&lt;root&gt;
    &lt;foo id="good" color="green"&gt;
      &lt;bar class="bad" color="red"&gt;
      &lt;/bar&gt;
    &lt;/foo&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>so that the effects of the css are represented in the attributes of the resulting tree.</p>
  
  <p>I can do this in python, but I thought there might be a simple way to reuse existing libraries to make it much easier.</p>
  
  <p>Thanks!</p>