Re: [xsl] Pattern: Processing Unwrapped Repeating Groups

Subject: Re: [xsl] Pattern: Processing Unwrapped Repeating Groups
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Fri, 01 Feb 2002 16:01:56 -0500
Hi Eliot,

At 09:49 AM 1/30/02, you wrote:
In trying to solve a problem in the style sheet I'm currently developing
I stumbled on a pattern that I hadn't seen anywhere in my reading on XSL
processing--it's probably obvious to most but it took me a while to
figure it out so I thought I would share it.

The input data consists of what I call "unwrapped repeating groups, that
is, a content model like this: ...

It is a known pattern, but it's not actually obvious to most. (For example, I just reviewed an otherwise-excellent XSLT how-to book that recommends -- ouch! -- a disable-output-escaping-based solution to this problem.) For the most part, we've seen this technique subsumed under grouping, which (largely to the work of Jeni T.) is a fairly-well understood problem area. (Check out her site, http://www.jenitennison.com.)


But it's broader than what most people think of as grouping, and really ought to be distinguished for itself. And you're right, I haven't seen it covered as such in the literature. (Watch out or someone will name it after you.)

When element types aren't enough to distinguish how the groups should be made -- one example is introducing hierarchy into a flat structure where "nested" sections are distinguished only by h1, h2, h3 elements and so forth -- sometimes we use keys to select elements that go with the "starter" element of each group.

The only slight improvement I'd suggest to your approach is to use the 'following-sibling' axis instead of 'following'. You'll find it much more efficient over large data sets, since 'following' is going to go further -- sometimes much further -- than just children of the same parent.

Cheers,
Wendell


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


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread