if I have an XML like this: (just to do an example)
Check out this Microsoft XPath count() tutorial.
count(/restaurant/tables/table)
will count the table elements in the above path.