RE: [xsl] saxon: [Language: en] in format-date()

Subject: RE: [xsl] saxon: [Language: en] in format-date()
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 28 Apr 2010 11:52:22 +0100
In future, please use the saxon-help list for reporting problems that are
specific to the Saxon product.

This is actually now working correctly in Saxon in cases where your default
Locale is say Germany or France - any locale that Saxon supports. The set of
locales that Saxon supports is open-ended - it depends on what localisation
modules have been registered with the Configuration.

The specification states: The set of languages, calendars, and countries
that are supported in the date formatting functions is
implementation-defined. When any of these arguments is omitted or is an
empty sequence, an implementation-defined default value is used.

In the case of Saxon, the implementation-defined default is taken from the
Java default locale, which in your case  probably means that the default
language is Russian. This means that Saxon doesn't distinguish the cases
where you omit the language argument, and cases where you explicitly ask for
Russian. In both cases, if you fail to register a localisation module for
Russian, Saxon will fall back to English and warn you that it has done so,
as required by the spec.

So, I guess the logic needs to become a bit more subtle: don't use the
default Java Locale unless a localisation module for this Locale has been
registered; or to put it another way, don't output the warning message that
a fallback language is being used unless a specific language was explicitly
requested.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 



> -----Original Message-----
> From: Leonid Schleicher [mailto:leonid@xxxxxxxxxxxxx] 
> Sent: 27 April 2010 09:20
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] saxon: [Language: en] in format-date()
> 
> Hello!
> 
> Output prefix [Language: en] in format-date() still not 
> solved in saxon.
> I've used latest saxon release - downloaded yesterday from sourceforge
> 
> to reproduce:
> 
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>     xmlns:xs="http://www.w3.org/2001/XMLSchema";
>    exclude-result-prefixes="xs" version="2.0">
>    <xsl:output method="text"/>
>     <xsl:template match="/">
>         <xsl:value-of select="format-date(current-date(), 
> '[D]-[M]-[Y]')"/>
>     </xsl:template>
> </xsl:stylesheet>
> 
> If system locale is differ than en, in output appears annoying prefix
> [Language: en]
> 
> To solve - use english system locale or use 
> -Duser.language=en in java parameters
> 
> 
> MfG, Leonid Schleicher

Current Thread