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.

XML-DEV Discussion Forum

XML-DEV is a leading technical forum for XML discussion and a valuable free XML learning resource. Subscribe to the XML-DEV email discussion forum today to help further your XML education.

XHTML Tools

Powerful XHTML Tools for converting HTML to XHTML, validating XHTML, transforming XML to XHTML, editing JSP, creating XML driven Websites and more.

XML-DEV Blog

Join the XML Development discussion at XML-Dev - the hottest place to talk about XML technologies, trends, systems architecture and all the latest buzz. Bookmark this RSS and ATOM feed now!

XML-to-HTML Mapper

Stylus Studio simplifies XML-to-HTML mapping through the industry's first and only XML to HTML mapping tool based on industry standard XSLT.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member