Description
The functx:sort-case-insensitive function sorts a sequence of values or nodes without regard to whether they are upper or lower-case. Normally, using most collations, all upper-case letters are sorted before all lower-case letters, so "Z" would come before "a". It returns the items in their original capitalization.
Arguments and Return Type| Name | Type | Description |
$seq |
item()* |
the sequence to sort |
| return value |
item()* |
XQuery Function Declaration| See XSLT definition. | | XQuery Syntax for July 2004 - January 2007 (1.0): |
|---|
declare namespace functx = "http://www.functx.com";
declare function functx:sort-case-insensitive
( $seq as item()* ) as item()* {
for $item in $seq
order by upper-case(string($item))
return $item
} ; | | XQuery Syntax for May 2003: |
|---|
declare namespace functx = "http://www.functx.com"
define function sort-case-insensitive
( $seq as item()* ) as item()* {
for $item in $seq
order by fn:upper-case(fn:string($item))
return $item
} |
Exampleslet $in-xml := | <in-xml>
<f>a</f>
<f>c</f>
<e>B</e>
</in-xml> | return |
| XQuery Example | Results |
|---|
functx:sort-case-insensitive(('a','c','B'))
|
('a', 'B', 'c')
|
functx:sort-case-insensitive($in-xml/*)
|
<f>a</f>
<e>B</e>
<f>c</f>
|
See AlsoHistory |
|