Project

Profile

Help

Support #4577

closed

Understanding collation order and the respect for spaces

Added by Ken Holman almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
Localization
Sprint/Milestone:
-
Start date:
2020-06-06
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hi, folks!

In my UBL work I'm switching from Unicode sort order to language sort order in order to sort capitalized abbreviations in order along with leading-capital words. Of course Unicode sort order puts caps in front of lower case and so something has to change.

However, when I change to a language sort, the spaces are being ignored in the collation. I'm using 9HE, is there a collation that respects spaces in sort order in front of letters? I've also tried strength=primary and strength=secondary but, again, the spaces are ignored.

Below is a transcript of the attached test file. I'm trying to get "ISPS Requirements" to sort after "Invoice Line".

Thank you for your guidance!

. . . . . Ken

~/t $ cat sort.xsl 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  exclude-result-prefixes="xsd"
  version="2.0">

<xsl:output method="text"/>
  
<xsl:template match="/">
  <xsl:variable name="strings" as="xsd:string*"
    select="('Request For Tender Line','Requested Tender Total',
             'Order Reference', 'Ordered Shipment',
             'Invoice Line', 'ISPS Requirements', 'Item',
             'Tender Result', 'Tendered Project',
             'Transportation Segment', 'Transport Schedule')"/>
  <xsl:text>Unicode order&#xa;&#xa;</xsl:text>
  <xsl:for-each select="$strings">
    <xsl:sort/>
    <xsl:value-of select="."/><xsl:text>&#xa;</xsl:text>
  </xsl:for-each>  
  <xsl:text>&#xa;Collation order </xsl:text>
  <xsl:text>http://saxon.sf.net/collation?lang=en&#xa;&#xa;</xsl:text>
  <xsl:for-each select="$strings">
    <xsl:sort
           default-collation="http://saxon.sf.net/collation?lang=en"/>
    <xsl:value-of select="."/><xsl:text>&#xa;</xsl:text>
  </xsl:for-each>  
  
  
</xsl:template>
  
</xsl:stylesheet>
~/t $ xslt2 sort.xsl sort.xsl 
Unicode order

ISPS Requirements
Invoice Line
Item
Order Reference
Ordered Shipment
Request For Tender Line
Requested Tender Total
Tender Result
Tendered Project
Transport Schedule
Transportation Segment

Collation order http://saxon.sf.net/collation?lang=en

Invoice Line
ISPS Requirements
Item
Ordered Shipment
Order Reference
Requested Tender Total
Request For Tender Line
Tendered Project
Tender Result
Transportation Segment
Transport Schedule
~/t $ 


Files

sort.xsl (1.1 KB) sort.xsl Ken Holman, 2020-06-06 02:16

Please register to edit this issue

Also available in: Atom PDF