XPath/XQuery last function

Summary

Returns the context size from the dynamic context.

Signature

fn:last(
) as xs:integer

Properties

This function is deterministic, context-dependent, focus-dependent, and special-streaming-rules.

Rules

Returns the context size from the dynamic context. (See .)

Examples

The expression (1 to 20)[fn:last() - 1] returns 19.

Error Conditions

A dynamic error is raised if the context size is absent.

Notes

Under most circumstances, the context size is absent only if the context item is absent. However, XSLT 3.0 with streaming defines situations in which the context item and context position are known, but the context size is unknown.