You don't need to count nodes for that: you can just write
<xsl:if test="/root/lookup/id = //item/id2">
[header html]
</xsl:if>
You could of course compute the count if you needed it, for example
count(//item/id2[. = /root/lookup/id])
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference