Subject: Re: [xsl] for-each-group and result-document splitting to less files. From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 08 Sep 2008 18:25:20 -0400 |
<xsl:function name="t:lettergroup" as="xs:string()"> <xsl:param name="element" as="element()"/> <xsl:value-of select="translate( substring(normalize-space(lower-case($element)),1,1), 'abcdefghijklmnopqrstuvwxyz012345678[,+(.><&&amp;', 'aaaaaaggggggmmmmmmssssssss999999999---------') "/> <!-- emits 'a','g','s','9' or '-' depending on the first letter of the value of $element, grouped into a-f, g-l, m-r, s-z, 0-9, or a punctuation mark (case insensitive) --> </xsl:function>
<xsl:for-each-group select="$persNamesWithoutKey" group-by="t:lettergroup(.)">...
Cheers, Wendell
On Fri, Sep 5, 2008 at 14:19, Michael Kay <mike@xxxxxxxxxxxx> wrote: >> I want to break it into 5 files for punctuation&numbers, a-f, >> g-l, m-r, and s-z. > > Part of the solution might be to use a grouping key created using > > translate(., 'abcdefghijklmnopqrstuvwxyz', 'aaaaaaggggggmmmmmmssssssss') >
Having had a chance to play with this on the outer xsl:for-each-group I did:
<xsl:for-each-group select="$persNamesWithoutKey" group-by="translate(substring(normalize-space(lower-case(.)),1,1),'abcdefghijklmnopqrstuvwxyz012345678[,+(.><&&amp; ', 'aaaaaaggggggmmmmmmssssssss999999999---------') ">
and with some minor cosmetic changes through the rest that did it absolutely perfectly for my needs.
I post this just for posterity (i.e. anyone else searching for a similar answer and in several months when I've forgotten how/why I did something like this!) ;-)
Many thanks,
-James
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] for-each-group and result, James Cummings | Thread | Re: [xsl] for-each-group and result, James Cummings |
Re: [xsl] xsl: parsing through spec, Mohit Anchlia | Date | [xsl] xslt function, Mohit Anchlia |
Month |