This is in accordance with the specification at
It would be nice to support this mapping, but it's not currently designed into the product (and there's nothing in the JAXP interface that says it should be).
There are a number of technical issues here that make it more difficult than one might imagine to take a java.util.Date as input. Your example, new GregorianCalendar(1066, 9, 14), despite appearances, actually represents the date 14 Oct 1066 in the Julian calendar, which corresponds to the date 1066-10-20 in the proleptic Gregoarian calendar used in the xs:dateTime data type. So the conversion isn't trivial, especially as the date for switching from one calendar to the other depends on which country you are in. It would be possible to convert by calling setGregorianChange() on the supplied GregorianCalendar object, but that doesn't work easily because I can't really modify an object supplied by the caller.
The XQJ interface for XQuery also struggles with this: it maps an xs:dateTime not to a java.util.GregorianCalendar or java.util.Date object, but to an instance of javax.xml.datatype.XMLGregorianCalendar.
Michael Kay

From: [] On Behalf Of
Sent: 30 August 2006 16:56
Subject: [saxon] can't pass Date parameters that validate as xs:dateTime

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=""

        <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>


Called from a minimal example 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();
        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.

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
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.