[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: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 25 Jan 2019 14:52:39 -0000
Re:  Grouping by letters but keep symbols together
On 25.01.2019 15:44, Rick Quatro rick@xxxxxxxxxxxxxx wrote:

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:

<xsl:for-each-group select="glossentry" group-by="upper-case(substring(glossterm/text(),1,1))">

<topicref navtitle="{current-grouping-key()}" toc="no">

...

</topicref>

</xsl:for-each-group>

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.

Along the idea of Michele's answer, but using XPath 2 and "replace" instead of "translate"


group-by="replace(upper-case(substring(glossterm, 1, 1)), '\P{L}', '#')

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.