title: Removing duplicates from XML with python
body: <p>I have an automatically updated XML file with format:</p>
  
  <pre><code>&lt;entry&gt;
    &lt;title&gt;Movie 1&lt;/title&gt;
    &lt;summary&gt;pics/movies/3a6f22.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Fri Dec  3 03:02:05 2018&lt;/time&gt;
  &lt;/entry&gt;
  &lt;entry&gt;
    &lt;title&gt;Movie 2&lt;/title&gt;
    &lt;summary&gt;pics/movies/ae4r12.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Fri Dec  3 05:34:06 2018&lt;/time&gt;
  &lt;/entry&gt;
  &lt;entry&gt;
    &lt;title&gt;Movie 1&lt;/title&gt;
    &lt;summary&gt;pics/movies/3a6f22.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Sat Dec  4 12:04:06 2018&lt;/time&gt;
  &lt;/entry&gt;
  &lt;entry&gt;
    &lt;title&gt;Movie 3&lt;/title&gt;
    &lt;summary&gt;pics/movies/3f44j2.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Sat Dec 4  14:04:07 2018&lt;/time&gt;
  &lt;/entry&gt;
  </code></pre>
  
  <p>My desired output would be:</p>
  
  <pre><code>&lt;entry&gt;
    &lt;title&gt;Movie 1&lt;/title&gt;
    &lt;summary&gt;pics/movies/3a6f22.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Fri Dec  3 03:02:05 2018&lt;/time&gt;
  &lt;/entry&gt;
  &lt;entry&gt;
    &lt;title&gt;Movie 2&lt;/title&gt;
    &lt;summary&gt;pics/movies/ae4r12.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Fri Dec  3 05:34:06 2018&lt;/time&gt;
  &lt;/entry&gt;
  &lt;entry&gt;
    &lt;title&gt;Movie 3&lt;/title&gt;
    &lt;summary&gt;pics/movies/3f44j2.jpg&lt;/summary&gt;
    &lt;link&gt;IMDB link&lt;/link&gt;
    &lt;time&gt;Sat Dec 4  14:04:07 2018&lt;/time&gt;
  &lt;/entry&gt;
  </code></pre>
  
  <p>That is being read by javascript and php to make a list with CSS. I am trying to filter out any duplicates (e.g. the last entry titled Movie 1). I've searched and found some xsl / xslt solutions that I couldn't get to function properly. My problem is that I would like to remove any duplicate entries with the same title, but the summary, link, or time do not need to match. </p>
  
  <p>I have tried:</p>
  
  <pre><code>from lxml import etree
  
  data = open('xmlparse.xsl')
  xslt_content = data.read()
  xslt_root = etree.XML(xslt_content)
  dom = etree.parse("movies.old.xml")
  transform = etree.XSLT(xslt_root)
  result = transform(dom)
  f = open('movies.new.xml', 'w')
  f.write(str(result))
  f.close()
  </code></pre>
  
  <p>which pulls from this .xsl</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
   &lt;xsl:output omit-xml-declaration="yes" indent="yes"/&gt;
   &lt;xsl:strip-space elements="*"/&gt;
  
   &lt;xsl:param name="pDoc1" select="document('movies.old.xml')"/&gt;
   &lt;xsl:param name="pDoc2" select="document('movies.current.xml')"/&gt;
  
   &lt;xsl:template match="/"&gt;
    &lt;xsl:apply-templates select="$pDoc1/*"/&gt;
   &lt;/xsl:template&gt;
  
   &lt;xsl:template match="/*"&gt;
    &lt;archive&gt;
     &lt;xsl:copy-of select="node()"/&gt;
     &lt;xsl:copy-of select="$pDoc2/*/entry[not(name = current()/*/name)]"/&gt;
    &lt;/archive&gt;
   &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>no effect though, my new output file stays empty.</p>
  
  <p>I have also tried using unique_everseen but that deletes data like <code>&lt;entry&gt;</code> and <code>&lt;/entry&gt;</code>, rearranges time attributes to the end of the file,  etc.. without mercy)</p>