Home >Online Product Documentation >Table of Contents >Determining the Context Size
To obtain the number of nodes in the current context, call the last() function. The format is
last()
number last()
The last() function returns a number equal to the context size of the expression evaluation context. Essentially, the last() function returns the position number of the last node in document order for the current context. For example, the following query returns all books if there are three or more of them. There are three book elements in the current context. Consequently, this query returns three book elements.
book
/bookstore/book[last() >= 3]