<p>Below is part of the XML which I am processing with <a href="http://php.net/XSLTProcessor" rel="nofollow noreferrer">PHP's XSLTProcessor</a>:</p>

<pre><code>&lt;result&gt;
    &lt;uf x="20" y="0"/&gt;
    &lt;uf x="22" y="22"/&gt;
    &lt;uf x="4" y="3"/&gt;
    &lt;uf x="15" y="15"/&gt;
&lt;/result&gt;
</code></pre>

<p>I need to know how many "uf" nodes exist where x == y.</p>

<p>In the above example, that would be 2.</p>

<p>I've tried looping and incrementing a counter variable, but I can't redefine variables.</p>

<p>I've tried lots of combinations of xsl:number, with count/from, but couldn't get the XPath expression right.</p>

<p>Thanks!</p>

```
```
count('/result/uf[@x = @y]')
```
```