Project

Profile

Help

Some querstion about XQuery statement

Added by Anonymous about 15 years ago

Legacy ID: #7634870 Legacy Poster: xu yang (xuyang85)

I am doing someting about xml processing with xquery,so I find these product, I downLoad the Saxon-B version 9.1.0.7 for java for try.I always push my xquery statement as input ,and wanna get the correct result sequence as output,When I try the FLOWR statement , i almost generate the result what i want. But just when I use the Order By statement to process the XML document which composed with Chinese characters ,I was so confused with the result. I just wanna know what rules or regulation used when I order an a Chinese Charactrer XML Document by an specified elemnet .


Replies (3)

Please register to reply

RE: Some querstion about XQuery statement - Added by Anonymous about 15 years ago

Legacy ID: #7634881 Legacy Poster: Michael Kay (mhkay)

The default collating sequence for "order by" is Unicode codepoint collation, which may not make much sense for Chinese. You can request a collation for Chinese language using order by ... collation "http://saxon.sf.net/collation/lang=zh" \or there are variants such as lang=zh-HK for Hong Kong. The actual languages available depend on your Java installation, and the actual collation rules for each language are in the Java VM, not in Saxon.

RE: Some querstion about XQuery statement - Added by Anonymous about 15 years ago

Legacy ID: #7636552 Legacy Poster: xu yang (xuyang85)

So I know the collation rules,but when I wanta order an document by a Chinese field .The rule what I want is ordering by the first letter in the pronunciation of the Chinese Characters.How could I write the XQuery statement?Plz give me a simple example .ths very much.

RE: Some querstion about XQuery statement - Added by Anonymous about 15 years ago

Legacy ID: #7636747 Legacy Poster: Michael Kay (mhkay)

I know nothing about Chinese collations, I'm afraid. If Java offers the collation you are looking for, then you can invoke it from Saxon using the various parameters of the collation URI. If Java doesn't offer the collation, then you can implement it yourself, either (a) by writing the rules in the format for a Java RuleBasedCollator and including those rules in the collation URI, or (b) by implenting a class that compares two strings (as an implementation of java.util.Comparator), and naming this class in the collation URI. Further information about collations in Saxon is available at http://www.saxonica.com/documentation9.2/extensibility/collation.html

    (1-3/3)

    Please register to reply