OK, I've had a look at this and I think you'll be able to run your query by defining your function as
declare function tns:isEmptyDate($dob as xs:date?) as xs:boolean
Note the ? after the type - it means that the argument may be the empty sequence.
I tested this out in Oxygen, using Saxon-B... sorry, I don't have access to the software you're using.
Here's my function definition.
declare function tns:isEmptyDate($dob as xs:date?) as xs:boolean {
let $empty := if (empty($dob))
then true()
else false()
return $empty
};
Running against this file:
<?xml version="1.0" encoding="UTF-8"?>
<datetime>2002-09-24</datetime>
returns true, and running against this file:
<?xml version="1.0" encoding="UTF-8"?>
<dontmatch>2002-09-24</dontmatch>
returns false.
Running the same function without the questionmark, on the second document, errors with:
Severity: error. Description: An empty sequence is not allowed as the first argument of tns:isEmptyDate()