title: lxml: split at attribute?
body: <p>I'm using lxml to scrape some HTML that looks like this:</p>
  
  <pre><code>&lt;div align=center&gt;&lt;a style="font-size: 1.1em"&gt;Football&lt;/a&gt;&lt;/div&gt;
  &lt;a href=""&gt;Team A&lt;/a&gt;
  &lt;a href=""&gt;Team B&lt;/a&gt;
  &lt;div align=center&gt;&lt;a style="font-size: 1.1em"&gt;Baseball&lt;/a&gt;&lt;/div&gt;
  &lt;a href=""&gt;Team C&lt;/a&gt;
  &lt;a href=""&gt;Team D&lt;/a&gt; 
  </code></pre>
  
  <p>How can I end up with data in the form</p>
  
  <pre><code>[ {'category': 'Football', 'title': 'Team A'},
  {'category': 'Football', 'title': 'Team B'},
  {'category': 'Baseball', 'title': 'Team C'},
  {'category': 'Baseball', 'title': 'Team D'}]
  </code></pre>
  
  <p>So far I've got:</p>
  
  <pre><code>results = []
  for (i,a) in enumerate(content[0].xpath('./a')):
       data['text'] = a.text
       results.append(data)
  </code></pre>
  
  <p>But I don't know how to get the category name by splitting at <code>font-size</code> and retaining sibling tags - any advice?</p>
  
  <p>Thanks!</p>