From: Michael Kay []
Sent: Thursday, February 02, 2012 7:25 AM
Subject: Re: [saxon] format-date() Language/locale issue


On 31/01/2012 20:10, Marzilli Dave wrote:



I am trying to resolve an issue around language specific “format-date()” behavior, one that seems environment specific.  We are seeing different results in one environment than another where we are expecting the same.  Both environs use saxon ee (same jar files), same xsl and input xml, both pipe to Apache FOP.  Neither environment uses a configuration file.  In the XSL writing environment we are running from the command line (through XML Spy), where the output works as expected.  In the test environment Saxon is invoked from Java code, where we receive the default language substitution ([Language: en]23 July 2010) noted in other posts here .  Is there an environment or machine dependency on format-date()?



Dave Marzilli


Sorry for the delay in responding.

Yes, there is an environment dependency. If no language is specified in the language argument of format-date(), the default is assumed to be the language of the default Java locale, which is generally taken from the user profile defined in the operating system.

The [Language: en] prefix in the output means that the requested language is one which is not recognized/supported in the Saxon configuration, so Saxon is outputting in English instead of the requested language.

I think your "" is probably a typo for "". What puzzles me is that at some time, well before 9.3, I made a change such that the [Language: en] prefix is added only if an unsupported language is requested explicitly, rather than if it is requested by virtue of defaults in the user profile.

So three follow-up questions come to mind:

(a) can you confirm which version you are using?

(b) what arguments are you supplying in the call to format-date()?

(c) what is the default language in the current user's profile?

Michael Kay


Hi, Thanks for getting back to me.


Answering your questions:


(a)    The version is in both environments.

(b)   Replacing for substituted variables, <xsl:value-of select="format-date($dateToFormat, ‘[D1] [MNn] [Y1]’, ‘de’, (), ())"/>

(c)    In both XSL development (where it works) and server (doesn’t work) environments the default language is English


Note that the language is represented as hardcoded in (b) above but in fact is a variable which resolves to one of four values (en/fr/de/es).




CONFIDENTIALITY: This communication, including attachments, is for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, or distribution or the taking of any action in reliance upon this information is strictly prohibited. If you are not the intended recipient, please notify the sender immediately and delete this communication and destroy all copies.