title: Checking for a duplicate element in the OUTPUT
body: <p>I've got some XML, for example purposes it looks like this:</p>
  
  <pre><code>&lt;root&gt;
      &lt;field1&gt;test&lt;/field1&gt;
      &lt;f2&gt;t2&lt;/f2&gt;
      &lt;f2&gt;t3&lt;/f2&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>I want to transform it with XSLT, but I want to suppress the second f2 element in the output - how do I check inside my template to see if the f2 element already exists in the output when the second f2 element in the source is processed? My XSLT looks something like this at present:</p>
  
  <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
    &lt;xsl:output method="xml" indent="no" omit-xml-declaration="yes" standalone="no" /&gt;
    &lt;xsl:template match="/"&gt;
      &lt;xsl:for-each select="./root"&gt;
        &lt;output&gt;
          &lt;xsl:apply-templates /&gt;        
        &lt;/output&gt;
      &lt;/xsl:for-each&gt;
    &lt;/xsl:template&gt;
    &lt;xsl:template match="*" &gt;
        &lt;xsl:element name="{name(.)}"&gt;
          &lt;xsl:value-of select="." /&gt;
        &lt;/xsl:element&gt;
    &lt;/xsl:template&gt;
  &lt;/xsl:stylesheet&gt;
  </code></pre>
  
  <p>I need to do some sort of check around the xsl:element in the template I think, but I'm not sure how to interrogate the output document to see if the element is already present.</p>
  
  <p>Edit: Forgot the pre tags, code should be visible now!</p>