saxonica.com

saxon:last-modified()

saxon:last-modified(uri as xs:string()?) ==> xs:dateTime?

The specification of this function has changed in Saxon 9.2. To find the last-modified date of the file from which a given node was loaded, use saxon:last-modified(document-uri($node))

This function returns the date and time when a file was modified.

If the argument is an empty sequence, the result is an empty sequence.

Otherwise the argument must be a valid URI. If it is a relative URI, this will be resolved against the base URI from the static context. The function has been tested with URIs using the file and http schemes, and is not guaranteed to give a result with other URI schemes (or indeed with these, under all circumstances).

The function returns an xs:dateTime value which will usually be in a specific timezone. The result can therefore be formatted using the format-dateTime function, or input to arithmetic and comparisons against other dates and times.

If the URI is not syntactically valid, error FODC0005 is thrown. If the resource identified by the URI cannot be retrieved, error FODC0002 is thrown. If the resource is successfully retrieved but no date/time information is available, the function returns an empty sequence.

Example:

format-dateTime(file-last-modified(resolve-uri('lookup.xml', static-base-uri()))

Next