fn:last

Returns the context size from the dynamic context.

Signature

fn:last() as xs:integer

Properties

This function is deterministic, context-dependent, and focus-dependent.

Rules

Returns the context size from the dynamic context. (See Dynamic Context Components.)

Error Conditions

A dynamic error is raised [ERRXPDY0002] 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.

Examples

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