Scratching big patchy spot at top of head but unable to figure out this one.

Trying to pass a java.util.Date parameter into a SaxonSA stylesheet and have it validate as an "xs:date" or "xs:dateTime" or any equivalent.

Always getting an error.


Minimal example XSLT: (SaxonParamTest.xslt)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  
                version="2.0">

        <xsl:output name="xml" method="xml" omit-xml-declaration="yes" indent="no" />
       
        <xsl:param    name="dateParam"   as="xs:dateTime"  />

        <xsl:template match="/">
                <xsl:message select="'dateParam = '"><xsl:value-of select="$dateParam"/></xsl:message>
        </xsl:template>

</xsl:stylesheet>

Called from a minimal example Java (SaxonParamTest.java):

public class SaxonParamTest {
       
    public static final String NULL_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                                          + "<rootElement/>";

    public final static String jaxpXformFactProp = "javax.xml.transform.TransformerFactory";
    public final static String saxnXformFactImpl = "com.saxonica.SchemaAwareTransformerFactory";

    public static void main(String[] args) throws TransformerException {
               
        System.setProperty(jaxpXformFactProp, saxnXformFactImpl);
        TransformerFactory tfactory = TransformerFactory.newInstance();

        // Create a transformer for the stylesheet.
        Transformer transformer = tfactory.newTransformer(new StreamSource("./src/simpletest/SaxonParamTest.xslt"));
       
        // Add a date parameter
        Date keyDate = new GregorianCalendar(1066, 9, 14).getTime();
        System.out.println(keyDate.toString());
        transformer.setParameter("dateParam", keyDate);

        // Transform the source XML to System.out.
        transformer.transform(new StreamSource(new ByteArrayInputStream(NULL_XML.getBytes())),
                              new StreamResult(System.out));                
    }

}


Getting this error message:

Validation error
  FORG0001: Invalid dateTime value. Non-numeric component

Thanks for any pointers.

-alan
*************************************************************************
This message and any attachments (the "message") are confidential and intended solely for the addressee(s).
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be liable for the message if altered, changed or
falsified.
                              ************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de ses
destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de ce message s'il a ete altere, deforme ou falsifie.
*************************************************************************