[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Grouping by letters but keep symbols together

Subject: Re: Grouping by letters but keep symbols together
From: "Eliot Kimber ekimber@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 25 Jan 2019 16:03:29 -0000
Re:  Grouping by letters but keep symbols together
In addition, the DITA Community i18n project on GitHub
(https://github.com/dita-community/org.dita-community.i18n) provides
general-purpose Saxon extensions and XSLT 2+ support for locale-aware
grouping, sorting, word and line breaking, and text size approximation. (The
code was originally developed to do generation of paginated EPUBs in a number
of languages, thus the need for locale-aware word and line breaking as well as
text size approximation in addition to sorting and grouping.)

While the code was developed for use with DITA docs it's not DITA-specific.
The current Java extensions are only bound to Saxon 9.1 because I didn't have
client funding to also do the Saxon 9.6+ integration. It shouldn't be that
hard but it's not something I've been able to pursue.

This project includes dictionary-based Simplified Chinese features by
integrating an open-source Simplified Chinese dictionary.

Cheers,

E.
--
Eliot Kimber
http://contrext.com


o;?On 1/25/19, 9:32 AM, "Eliot Kimber ekimber@xxxxxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

    Beyond all these suggestions, I always create functions that return
grouping and sort  keys as the logic could be much more sophisticated,
especially if you bring in locale-aware processing.

    Cheers,

    E.
    --
    Eliot Kimber
    http://contrext.com


    o;?On 1/25/19, 9:07 AM, "Graydon graydon@xxxxxxxxx"
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

        On Fri, Jan 25, 2019 at 02:44:50PM -0000, Rick Quatro
rick@xxxxxxxxxxxxxx scripsit:
        >    I am creating a glossary and I want to group entries under each
letter of
        >    the alphabet. I am using this and it is working fine:
        [snip]
        >    However, I want to group entries that start with a symbol or
number all
        >    together under one group. I am not sure what to use for the
group-by
        >    attribute so that letters are separate from each other and all of
the
        >    non-letter characters are in the same group. Any suggestions
would be
        >    appreciated. Thank you very much.

        I'd use a Unicode character category match for this:

        <xsl:for-each-group select="glossentry"
           group-by="(substring(upper-case(glossterm),1,1)[matches(.,'\p{Lu}'
)],'NON-LETTER-GROUP')[1]">
            <topicref navtitle="{current-grouping-key()}" toc="no">
                ...
            </topicref>
        </xsl:for-each-group>

        What you put in for "NON-LETTER-GROUP" might depend on where or how
        you're sorting the glossary entries.

        -- Graydon

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.