Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To only check (and warn you of a duplicate), you may find an <a href="http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/200807/msg00444.html" rel="nofollow noreferrer">example here</a></p> <p>Something along the lines of:</p> <pre><code>&lt;xsl:for-each-group select="collection(...)//@id" group-by="."&gt; &lt;xsl:if test="count(current-group()) ne 1"&gt; &lt;xsl:message&gt;Id value &lt;xsl:value-of select="current-grouping-key()"/&gt; is duplicated in files &lt;xsl:value-of select="current-group()/document-uri(/)" separator=" and "/&gt;&lt;/xsl:message&gt; &lt;/xsl:if&gt; &lt;/xsl:for-each-group&gt; </code></pre> <p>To be modified to select all nodes within 'root' element.</p> <p>As to remove the duplicate lines, you have another <a href="http://graflex.org/klotz/weblog/2005/02/xslt-duplicate-elimination.html" rel="nofollow noreferrer">example here</a></p> <p>That would look like:</p> <pre><code>&lt;xsl:stylesheet&gt; &lt;xsl:key name="xyz" match="record[x/y/z]" use="x/y/z" /&gt; &lt;xsl:variable name="noxyzdups" select="/path/to/record[generate-id(.) = generate-id(key('xyz', x/y/z))]" /&gt; ... &lt;xsl:template ... &gt; &lt;xsl:copy-of "exslt:node-set($noxyzdups)" /&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>x/y/z is the xpath expression that you want made unique. It can be concat(x,'-',@y,'-',z) or whatever you want. </p> <p>Now I am not sure those two examples can easily be adapted to your case, but I just wanted to point out those two sources, in case it helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload