tags:

views:

98

answers:

2

Below is part of the XML which I am processing with PHP's XSLTProcessor:

<result>
    <uf x="20" y="0"/>
    <uf x="22" y="22"/>
    <uf x="4" y="3"/>
    <uf x="15" y="15"/>
</result>

I need to know how many "uf" nodes exist where x = y.

In the above example, that would be 2.

I've tried looping and incrementing some var, but I can't redefine variables.

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

Thanks!

+1  A: 
count('/result/uf[@x = @y]')
omellet
+5  A: 
<xsl:value-of select="count(/result/uf[@y=@x])" />
fd