Does anyone know how to peform counts with Xpath?

Here's what i've grasped so far i.e. making sure Ive installed xpath api and thats about it really!!

I've done a best guess as I cant find any info on the web so far (see below) there's no syntax errors and the variable questionscount is 'undefined'.

import mx.xpath.XPathAPI; 	
var titlePath:String = "//quiz/title/items/";
var questionscount:Number = count.nodeValue(titlePath);
trace (questionscount);
Does anybody knwo the syntax and can help me out?
Would also be interesting to know how to count where the node value of "//quiz/title/items/category" is "XXXX" etc..,