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

Subject: Re: [xsl] Can group-by treat its target it two ways?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 08 Nov 2011 11:00:37 -0500
Hi Mark,

On 11/7/2011 8:14 PM, Mark wrote:
if contains($seq,lower-case(substring(@word,1,1)))

Interesting, My "group-by" was used to name the files that each current-group() produced, one for each letter of the Czech alphabet. My very verbose expression did this using the current-grouping-key(). Would your code produce one file each for the four diacritical letters in $seq? or put them all in one file?

Andrew and I are refactoring only the conditional test in your group-by expression (or parts of it), without reference to what happens inside the grouping. So (if done right) these modifications should work just like your present code.

Also, don't forget the digraph 'ch', the ninth letter of the Czech
alphabet - can you find a succinct way to insert it in your more terse

If the two-character sequence "ch" represents the digraph -- as implied by your original code, although IANAC (I am not a Czech) -- the regex I suggested yesterday does that:

if matches(lower-case(@word),'^([D
then replace(lower-case(@word),'^([D
else lower-case(substring(cps:remove-diacritics(@word), 1, 1))

The use of the = operator to reduce the set of "or" clauses (as Andrew suggested) and the "contains()" trick would handle only the single-letter cases. You'd still have to handle the "ch" case on its own:

group-by="if contains($seq,lower-case(substring(@word,1,1))) 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))"


Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.      
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