[Home] [By Thread] [By Date] [Recent Entries]
James,
If this were my code, I'd be sorely tempted to encapsulate the logic in a function, if only to make it more legible and maintainable. This would also provide you a nice neat place to document it and its rationale. Something like: <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>Then <xsl:for-each-group select="$persNamesWithoutKey"
group-by="t:lettergroup(.)">...BTW, why the double-escaping of '&amp;'? I can't see how that would do anything for you. The processor will see only the string '& a m p ;' here, which translate() will decompose into characters. Cheers, Wendell At 08:02 AM 9/8/2008, you wrote: 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') > ====================================================================== 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 ======================================================================
|

Cart



