Saxon uses the lang attribute to request a Locale object from Java, and then asks Java for the collator appropriate to that Locale. I think it's the case that if you ask Java for a Locale that isn't installed, you will get back a default Locale. So I think we need to establish whether your Java VM actually has an installed Locale for country=cn, language=zh. It should be possible to determine this by using the static method
 
java.util.Locale.getAvailableLocales()
 
There is some information about which Locales are supported in JDK 1.5 at
 
http://java.sun.com/j2se/1.5.0/docs/guide/intl/locale.doc.html
 
However, you don't actually say which Java VM you are using.
 
If the Java Locale for zh-CN is present, but the collation doesn't meet your expectations, then this will have to be taken up with the supplier of your JVM/class library (presumably Sun?). But first we need to establish whether it is actually installed.
 
Regards,
 
Michael Kay
Saxonica


From: saxon-help-bounces@lists.sourceforge.net [mailto:saxon-help-bounces@lists.sourceforge.net] On Behalf Of Lizl
Sent: 18 March 2008 02:33
To: saxon-help@lists.sourceforge.net
Subject: [saxon] seek help for sort chinese characters

Hello:

  I have a question wants to ask about saxon6.5.3 support chinese charactors for <xsl:sort> element.
 
We are using Saxon6.5.3 and xsl1.0 to create a PDF document in Simplified Chinese. This document has an index and glossary that must be sorted.

But when sort chinese characters using <xsl:sort> elemen, the sort result is not correct, the xml and xsl files as follows:


<!-- country.xml -->
<?xml version="1.0" encoding="gb2312"?>
<root>
<book>
<title>中国(Zhong guo)(4)</title>
</book>
<book>
<title>美国(Mei guo)(2)</title>
</book>
<book>
<title>日本(Ri ben)(3)</title>
</book>
<book>
<title>俄罗斯(e luo si)(1)</title>
</book>
</root>
<!-- sort.xsl -->
<?xml version="1.0" encoding="GB2312"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<root>
<xsl:for-each select="root/book">
<xsl:sort select="title" lang="zh-CN"/>
<p>
<xsl:value-of select="title"/>
</p>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
The result shoud be:(using MSXML Engine)
<?xml version="1.0" encoding="UTF-16"?>
<root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<p>俄罗斯(e luo si)(1)</p>
<p>美国(Mei guo)(2)</p>
<p>日本(Ri ben)(3)</p>
<p>中国(Zhong guo)(4)</p>
</root>
but when I use the saxon6.5.3, the result is:(this is wrong result)
<?xml version="1.0" encoding="utf-8"?>
<root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<p>中国(Zhong guo)(4)</p>
<p>俄罗斯(e luo si)(1)</p>
<p>日本(Ri ben)(3)</p>
<p>美国(Mei guo)(2)</p>
</root>


使用新一代 Windows Live Messenger 轻松交流和共享! 立即体验!