Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Assuming you want to check the value of the current footnote <code>text()</code> against previous footnote <code>text()'s</code> for uniqueness, then you can just check the <code>preceding-sibling::node()'s text()</code>:</p> <pre><code>&lt;xsl:if test="$string = preceding-sibling::node()/text()"&gt; </code></pre> <p>e.g.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" &gt; &lt;xsl:output omit-xml-declaration="yes" method="xml" version="1.0" indent="yes" /&gt; &lt;xsl:template match="/xml"&gt; &lt;xml&gt; &lt;xsl:apply-templates select="footnote" /&gt; &lt;/xml&gt; &lt;/xsl:template&gt; &lt;xsl:template match="footnote"&gt; &lt;xsl:variable name = "string"&gt; &lt;xsl:value-of select="./text()"/&gt; &lt;/xsl:variable&gt; &lt;xsl:variable name = "bool"&gt; &lt;xsl:if test="$string = preceding-sibling::node()/text()"&gt; &lt;xsl:text&gt;false&lt;/xsl:text&gt; &lt;/xsl:if&gt; &lt;/xsl:variable&gt; &lt;xsl:if test="$bool != 'false'"&gt; &lt;xsl:copy-of select="."&gt;&lt;/xsl:copy-of&gt; &lt;/xsl:if&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>Will turn the input:</p> <pre><code>&lt;xml&gt; &lt;footnote&gt; someVal &lt;/footnote&gt; &lt;footnote&gt; anotherVal &lt;/footnote&gt; &lt;footnote&gt; anotherVal &lt;/footnote&gt; &lt;footnote&gt; newVal &lt;/footnote&gt; &lt;/xml&gt; </code></pre> <p>Into:</p> <pre><code>&lt;xml&gt; &lt;footnote&gt; someVal &lt;/footnote&gt; &lt;footnote&gt; anotherVal &lt;/footnote&gt; &lt;footnote&gt; newVal &lt;/footnote&gt; &lt;/xml&gt; </code></pre> <p>You should also look at Muenchian grouping if your intention is to identify groups within elements.</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