RE: [xsl] TOC Problem

Subject: RE: [xsl] TOC Problem
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Thu, 03 Mar 2005 13:20:17 -0500

At 09:31 AM 3/3/2005, you wrote:
Ok, i am able to fetch all the beginnings of the speeches per speaker. But
if i access a further speech of a speaker
, further means all speeches after the first one, the TOC is falsly extended
in this way:

Table Of Content
Joe.........1, 3, 7
Bob............2, 5
Joe........... 3, 7  <- false
Bob...............5  <- false
Joe...............7  <- false

So i have to memorize all the speakers i have already treated to treat them
not again. But i do not know how to memorize!?

That's why this is a grouping problem (which was my hint yesterday, and someone else's, I think).

An essential aspect of grouping is de-duplicating (boy do I wish there were another word for that ... I suppose "removing duplicates" might do), so that each group is processed once. If you do not de-duplicate your list of grouped items, each group is processed as many times as there are members of the group.

That's why you're getting three listings for Joe. If he appeared a fourth time you'd get a fourth listing.

Look again at those resources on grouping and see whether they don't help.

In particular, in XSLT/XPath it's not a matter of "memorizing" whether a name has been encountered already, but rather of selecting not "all names" but rather "all names *the first time they appear*". Having selected all names the first time they appear, you then proceed to process, for each of those names, all their appearances.

That's how they get grouped -- and this is, in fact, the essence of the "Muenchian method" of grouping in XSLT (which you will find to be well-documented).


====================================================================== 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