Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Dec 2003 20:43:08 +0900 (JST)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        martin@sumuk.de, horcicka@freebsd.cz
Cc:        freebsd-doc@FreeBSD.org
Subject:   Re: Problems with mirrors.xml and advisories.xml
Message-ID:  <20031219.204308.35475294.hrs@eos.ocn.ne.jp>
In-Reply-To: <20031218.093648.106310964.hrs@eos.ocn.ne.jp> <20031218010852.A44498@sumuk.de>
References:  <20031215174940.B38847@www.freebsd.cz> <20031218010852.A44498@sumuk.de> <20031218.093648.106310964.hrs@eos.ocn.ne.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Fri_Dec_19_20:43:09_2003_119)--
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

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

martin> I encountered the same problem when sorting by
martin> translated country names.  Attached is a simple
martin> test case:  Running =BBxsltproc sort.xsl names.xml=AB
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 o=
f
 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 situati=
on
 of languages using their own character set such as Russian and Chinese=
.=


--
| Hiroki SATO

----Next_Part(Fri_Dec_19_20:43:09_2003_119)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="sort.xsl"

<?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">
    &#192;&#193;&#194;&#195;&#196;&#197;&#198;&#256;
    &#199;
    &#208;
    &#200;&#201;&#202;&#203;&#274;
    &#204;&#205;&#206;&#207;&#298;
    &#209;
    &#210;&#211;&#212;&#213;&#214;&#216;&#332;&#338;
    &#217;&#218;&#219;&#220;&#362;
    &#221;
    &#224;&#225;&#226;&#227;&#228;&#229;&#230;&#257;
    &#231;
    &#232;&#233;&#234;&#235;&#275;
    &#236;&#237;&#238;&#239;&#299;
    &#241;
    &#242;&#243;&#244;&#245;&#246;&#248;&#333;&#339;
    &#223;
    &#249;&#250;&#251;&#252;&#363;
    &#253;&#255;
  </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>

----Next_Part(Fri_Dec_19_20:43:09_2003_119)----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031219.204308.35475294.hrs>