My first contribution to a W3C standard: The default-language() XPath / XQuery function

I felt honoured and happy when I was informed this week by XQuery co-inventor Jonathan ROBIE that my proposal this week was accepted by the Xpath/Xquery working group at the W3C!

While XSLT spec lead Michael KAY pointed out, it is rather unlikely that a new functionality is to be added while a new version of a standard is already in the Candidate Recommendation pahse (like the spec’s v3.1 already is, and it is even more unlikely that a new proposal is added within few weeks, I actually am totally happy that both happened in case of my proposal: I filed it end of June, and it was agreed by the working group mid of July – midst of the Candidate Recommendation phase. You daresay that I am really proud and happy to have achieved this.

So you can expect XSLT transformers like SAXON soon to be able to not only respect the local language when applying Xpath formatting functions like Thanks to my new default-language() function I have proposed to the W3C you will be even able to write your own functions doing so.

For example, if I you want to write an XPath function that formats phone numbers according to the location one performs a report, in Germany you would expect to get  (00 49 12 34) 56 78 90, while an international format would look like +49 1234 567890. So how to get the current locale? The answer is what I have proposed and now will become an international cross-vendor standard: default-language().

The default-language() method will return a string which is never null but always a valid language token (such a the format-dateTime() method would consume it). It comes in hand in any kind of custom function which is language dependend by nature, so writing functions like format-phone() will be possible and pretty easy now.


About Markus Karg

Java Guru with +30 years of experience in professional software development. I travelled the whole world of IT, starting from Sinclair's great ZX Spectrum 48K, Commodore's 4040, over S/370, PCs since legendary XT, CP/M, VM/ESA, DOS, Windows (remember 3.1?), OS/2 WARP, Linux to Android and iOS... and still coding is my passion, and Java is my favourite drug!
This entry was posted in Open Source, Programming, Standards and tagged , , . Bookmark the permalink.