[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] for-each-group group-by

Subject: Re: [xsl] for-each-group group-by
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 04 Apr 2012 17:07:37 -0400

At 2012-04-04 21:03 +0000, Craig Sampson wrote:
I am creating an index of paper titles using xsl:for-each-group to select and group by the titles of the papers alphabetically using the first character of the title.

<xsl:for-each-group select="//section" group-by="upper-case(substring(normalize-space(paperTitle),1,1))">
<xsl:sort select="current-grouping-key()"/>
. . .

Some of the paper titles start with double left hand quotes. Others start with a numeral. In those cases I want the group-by to use the first alpha character in the title string. I could do this if regular expressions were allowed in the group-by attribute, but they're not.

Actually, the replace() function is allowed in the group-by= attribute and you can use regular expressions in that function.

I hope this helps.

. . . . . . . . . . Ken

Public XSLT, XSL-FO, UBL and code list classes in Europe -- May 2012
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Google+ profile: https://plus.google.com/116832879756988317389/about
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal

Current Thread