last function
The fn:last function returns the number of values in the sequence that is being processed.
Syntax
Returned value
If the sequence that is currently being processed is not the empty sequence, the returned value is the number of values in the sequence. If the sequence that is currently being processed is the empty sequence, the returned value is the empty sequence.
Example
The following example uses the function as a predicate expression to return last item in the current sequence:
(<a/>, <b/>, <c/>)[fn:last()]
The returned value is <c/>.