Is there a function that can take either a date or datetime and in both cases
extract the date?
So for 1956-01-03T00:00:00.0000000+02:00 it would give 1956-01-03 and same
output for 1956-01-03.
I am needing this because although I am expecting a date, I might receive a
datetime from some external systems because of their own constraints.
I think you need to do something like this
if ($x castable as xs:dateTime) then xs:date(xs:dateTime($x)) else xs:date($x)
This question isn't Saxon-specific; a better place for general XSLT an XPath
questions is the xsl-list at mulberrytech.com, or StackOverflow.
I have learned to use a horrible hack, assuming $x is a string ...
xs:dateTime( fn:replace( $x , "T.*:,"") )