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

Re: Can group-by treat its target it two ways?

Subject: Re: Can group-by treat its target it two ways?
From: "Mark" <mark@xxxxxxxxxxxx>
Date: Sat, 5 Nov 2011 12:00:29 -0700
Re:  Can group-by treat its target it two ways?
Thanks Ken.
By the way, I note that two letters in my expression do not appear correctly in the email because of localization problems. The first two letters should be a c and r with a hacek (caret) above them, not the 'A' with umlaut and ring + TM as my email client shows.


My index is now complete. Thanks for all the help everyone has given me.
Mark

-----Original Message----- From: G. Ken Holman
Sent: Saturday, November 05, 2011 11:41 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: Can group-by treat its target it two ways?


Don't forget you can also use starts-with() for
your tests, and then you don't have to sometimes
use a length of 1 and sometimes use a length of 2.

I hope this helps.

. . . . . . . . . Ken

At 2011-11-05 11:18 -0700, Mark wrote:
Hi Michael and Martin,
I believe you are right, no general solution exists for the reasons Michael mentioned.
However, for the archives, I ended up with this monstrosity that does the job (ugly as it is):


<xsl:for-each-group select="Word" group-by="if (lower-case(substring(@word,1,1)) eq 'CB
' or
lower-case(substring(@word,1,1)) eq 'Cb"' or lower-case(substring(@word,1,1)) eq 'E!' or lower-case(substring(@word,1,1)) eq 'E>') then lower-case(substring(@word,1,1)) else if (lower-case(substring(@word,1,2)) eq 'ch') then 'ch' else lower-case(substring(cps:remove-diacritics(@word), 1, 1))">

<xsl:result-document href="{concat('index/cz-', current-grouping-key())}.htm">

Where cps:remove-diacritics() is defined as:
<xsl:function name="cps:remove-diacritics">
<xsl:param name="in-string"/>
<xsl:value-of select="replace(normalize-unicode($in-string, 'NFKD'), '[&#x0300;-&#x036F;]', '')"/>
</xsl:function>


Thanks all,
Mark


--
Contact us for world-wide XML consulting and instructor-led training
Free 5-hour video lecture: XSLT/XPath 1.0 & 2.0 http://ude.my/t37DVX
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

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.