Re: [xsl] sorting question

Subject: Re: [xsl] sorting question
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 24 Oct 2017 16:28:36 -0000
I can't reproduce this.

With this source document

<data>
    <entry>LC<beck, Stadtrat</entry>
    <entry>LC<beck</entry>
</data>

and this stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
    xmlns:math="http://www.w3.org/2005/xpath-functions/math";
    exclude-result-prefixes="xs math"
    version="3.0">

    <xsl:template match="/">
        <out>
            <xsl:perform-sort select="/data/entry">
                <xsl:sort lang="de"
                    collation="http://saxon.sf.net/collation?lang=de;alphanum
eric=yes"
                    select="."/>
            </xsl:perform-sort>
        </out>
    </xsl:template>

</xsl:stylesheet>

I get this output:

<?xml version="1.0" encoding="UTF-8"?>
<out><entry>LC<beck</entry><entry>LC<beck, Stadtrat</entry></out>

So I think the answer is probably yes, you are doing something wrong. If you
tell us in more detail what you are doing, then we can probably identify your
error.

Michael Kay
Saxonica



> On 24 Oct 2017, at 16:50, Torsten Schassan schassan@xxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Dear colleagues,
>
> I've got a question concerning xsl:sort.
>
> I deal with TEI files and try to process <index> (and other) entries in
> order to generate an index. I apply the following <xsl:sort>:
>
> <xsl:sort lang="de"
> collation="http://saxon.sf.net/collation?lang=de;alphanumeric=yes";
> select="."/>
>
> Now I face the problem that longer entries are sorted *before* shorter
> ones although shorter should mean "more general" and thus it would be
> preferable to have them listed first.
>
> e.g.:
> - LC<beck, Stadtrat
> - LC<beck
>
> Am I doing something wrong? Should I use another collation? Do I have to
> deal with the special characters like commas etc?
>
> BTW, I'm using Oxygen 17.1 and Saxon-HE 9.6.0.7.
>
> Curious, best,
> Torsten
>
>
> --
> Torsten Schassan - Digitale Editionen, Abteilung Handschriften und
> Sondersammlungen
> Herzog August Bibliothek, D-38299 Wolfenbuettel, Tel. +49 5331 808-130
> Fax -165
> Handschriftendatenbank <http://diglib.hab.de/?db=mss>

Current Thread