sort by : insensitive case

i have the following problem :

declare namespace ctxC=‘contractX/contractX’ declare namespace ctxP=‘contractX/contractXParty’ declare namespace ctxPers=‘contractX/contractXPerson’ declare namespace ctxCD=‘contractX/contractXDraft’ declare namespace ctxN=‘contractX/contractXNotification’ declare namespace ctxO=‘contractX/contractXOrganisation’ declare namespace ctxCS=‘contractX/contractXContractStatus’ declare namespace ctxRQ=‘contractX/contractXReportQueries’ declare namespace tf=‘’ declare namespace xf=‘W3C XQuery 1.0 and XPath 2.0 Functions and Operators’ declare namespace dc=‘’ declare namespace office=‘’ declare namespace ctxNX=‘contractX/contractNonXml’ declare namespace xs=‘’ for $party in ( input()/:contractXParty) where (‘a’) =‘a’ return {data($party/:PartyDetails/:PartyReferenceDetails/:PartyInternalNumber)}{data($party/:PartyDetails/:PartyName)}{data($party/:PartyDetails/:PartyReferenceDetails/:PartyTypeCode)}{data($party/:PartyDetails/:PartyAddressDetails/:AddressCityName)}{data($party/:PartyDetails/:PartyAddressDetails/*:AddressCountryCode)} sort by(name)

sort first number, then uppercase and finally lowercase. how make a insensitive case sorting ?


Since Tamino XQuery does not support the fn:upper-case() or fn:lower-case() function you have to specify an according default collation to perform a case-insensitive sort. An example query looks like:

declare default collation “collation?language=en;strength=secondary”

(“a”,“B”) sort by (.)

The result of the query is:


This also works if the input strings contain digits. The following query

declare default collation “collation?language=en;strength=secondary”

(“a”,“1a”,“B”) sort by (.)

Gives the result:


Please note that the default collation support in XQuery has been introduced with Tamino 4.2.

Best regards,

Thorsten Fiebig