Problems with mirrors.xml and advisories.xml

Hiroki Sato hrs at FreeBSD.org
Fri Dec 19 11:45:41 UTC 2003


Martin Heinen <martin at sumuk.de> wrote
  in <20031218010852.A44498 at sumuk.de>:

martin> I encountered the same problem when sorting by
martin> translated country names.  Attached is a simple
martin> test case:  Running »xsltproc sort.xsl names.xml«
martin> will produce the following list:

 Please try the attached stylesheet?  This includes a quick hack
 to fix the sort order based on the order of accent marks in
 Unicode code map.  I do not know if this is a reasonable order
 or not because my knowledge of languages spoken in European
 countries is very limited.

 The mechanism used in the quick hack is that accent marks in a target
 string are replaced with alphabets included in US-ASCII, and the set of
 strings are sorted based on the replaced string first, and on the
 original string after that.  

 However, in German ordering, "a:" (a with umlaut) is just after
 "a", but in Swedish ordering, "a:" is after "z", to the best of
 my memory...  So if customizing a sort table used in the quick hack
 can solve the problem, I will commit this with the necessary
 customization layer.  Or if the problem cannot be solved with such
 simple hack, I will take another approach to specify the sort
 order manually.

 Any comments are welcome.  Especially I would like to know the situation
 of languages using their own character set such as Russian and Chinese.

--
| Hiroki SATO
-------------- next part --------------
<?xml version="1.0" encoding="iso-8859-1"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:output type="xml" encoding="iso-8859-1"
	      omit-xml-declaration="yes"
	      indent="yes"/>

  <xsl:param name="sortlist-from">
    ÀÁÂÃÄÅÆĀ
    Ç
    Ð
    ÈÉÊËĒ
    ÌÍÎÏĪ
    Ñ
    ÒÓÔÕÖØŌŒ
    ÙÚÛÜŪ
    Ý
    àáâãäåæā
    ç
    èéêëē
    ìíîïī
    ñ
    òóôõöøōœ
    ß
    ùúûüū
    ýÿ
  </xsl:param>

  <xsl:param name="sortlist-to">
    AAAAAAAA
    C
    D
    EEEEE
    IIIII
    N
    OOOOOOOOO
    UUUUU
    Y
    aaaaaaaa
    c
    eeeee
    iiiii
    n
    oooooooo
    s
    uuuuu
    yy
  </xsl:param>

  <xsl:template match="/list">
    <list>
    <xsl:for-each select="word">
      <xsl:sort select="translate(., normalize-space($sortlist-from), normalize-space($sortlist-to))" />
      <xsl:sort select="." />
      <word>
      <xsl:value-of select="." />
      </word>
    </xsl:for-each>
    </list>
  </xsl:template>
</xsl:stylesheet>


More information about the freebsd-doc mailing list