saxon:last-modified
Returns the date and time when a file was modified.
last-modified($uri as xs:string?) ➔ xs:dateTime
Arguments | |||
| $uri | xs:string? | The URI of the required file |
Result | xs:dateTime |
Namespace
http://saxon.sf.net/
Saxon availability
Requires Saxon-PE or Saxon-EE. Available for Java and C/C++ only (not .NET).
Notes on the Saxon implementation
Available since Saxon 9.0; revised in Saxon 9.2. Not available in SaxonCS.
Details
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(saxon:last-modified(resolve-uri('lookup.xml', static-base-uri()))This function differs from the EXPath function file:last-modified
in that it takes
a URI rather than a filename as input, and may work for resources other than files: for example,
HTTP resources, provided the last-modified
header is present in the HTTP response.
To find the last-modified date of the file from which a given node was loaded, use
saxon:last-modified(document-uri($node))
.