[xsl] Different results of format-date() when using empty seq. or omitting args for lang/cal/country args

Subject: [xsl] Different results of format-date() when using empty seq. or omitting args for lang/cal/country args
From: Abel Braaksma <abel.online@xxxxxxxxx>
Date: Mon, 02 Oct 2006 12:36:27 +0200
Dear List,

While trying to output a value as ISO calendar using a default language, I came across a little niche in the xslt specification that I find hard to interpret right. My problem is this: when I want to output as ISO calendar, I have to provide the last three arguments for format-date(). The spec says that I can use the empty sequence to use for the default value, which value is implementation-defined. Fair enough. But when I use the empty sequence for language, the processor defaults to language X and outputs with [Language: en] somedate, saying in fact that it does not support the default language requested! Am I missing something, or is this is a processor dependent bug?

My hunch is that the processor takes the current language setting from system properties, which is, likely, to vary from system to system (in my case 'nl'). What I expected it to, is to default to a fixed language code, namely 'en' (or any other for that matter). That way, the following two statements would be equal:

Ex 1) format-date(current-date(), '[D1]/[Y1]')
Ex 2) format-date(current-date(), '[D1]/[Y1]', (), (), ())

Output ex. 1) 10/2006
Output ex. 2) [Language: en] 10/2006

In some way, this feels like violating the specs, but I cannot be sure of that. The specs say: "When any of these arguments is omitted or is an empty sequence, an implementation-defined default value is used."

You can only omit all three last arguments at once. I expect the "default value" to be the same all the time, instead being different for 'omitting' and 'empty sequence'.

I would like to use the following statement (3), for logging my stuff to some system. Unfortunately I have to resort statement (4), to get rid of the [Language: en] part in the output. But specifying the language does not feel right, because I want the default to be used, to be sure the processor can support the default (but it doesn't).

Ex 3) format-date(current-date(), '[D1] [MNn] [Y1], (), 'ISO', ())
Ex 4) format-date(current-date(), '[D1] [MNn] [Y1], 'en', 'ISO', ())

Output ex 3) [Language: en]2 October 2006
Output ex 4) 2 October 2006

Does anybody has some experience with this with other processors? Anybody any thoughts on this or on how I should interpret the particular part of the specs? Is the spec indeed open to implement for different outputs for (1) and (2), or is that an error in the processor?

I tested with Saxon 8.7.1

Cheers,
Abel Braaksma

Current Thread