Determining the Number of Nodes in a Collection

To obtain the number of nodes in a node set, call the count() function. The format is

number count(node-set) 
               

            

The count() function returns the number of nodes in the specified set. For example, the following query finds all authors who have more than ten publications:

//author[count(publications) > 10] 
               

            

To obtain the number of nodes in the current context, call the last() function, described in the next section.

 
Free Stylus Studio XML Training:
W3C Member