[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Displaying Unique attribute value


Subject: Re: [xsl] Displaying Unique attribute value
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 29 Oct 2008 10:43:21 -0400

Hi,

At 10:12 AM 10/29/2008, Syd wrote:
I think maybe I don't understand the desired input & output quite
correctly here. I would have thought something like

   <xsl:if
        test=" normalize-space( @page-num )
               !=
               normalize-space( preceding::*[@page-num][1]/@page-num )">

would do the trick. Is there something wrong with this approach that
I'm missing? Perhaps the grouping approach suggested is significantly
more efficient?

It depends on the processor, but generally, yes it is. A processor might well not have the smarts to avoid collecting all the @page-num attributes on all the preceding elements that have one, before it looks at the first. If you do this very much, that could be many checks back through the entire document.


The "grouping approach" (which is really misnamed since the essence of the Muenchian method isn't in the grouping as such, but in the analysis of distinct values, which is the harder part) will tend to be more efficient. This is because it works, in effect, by pre-indexing the tree (that's what the key does), allowing for quick retrieval.

There's no reason a processor couldn't do this by itself, or optimize the check on the preceding:: axis in some other way. For example, one can readily envision a TEI-specialized XSLT engine that would do special things with TEI input and/or recognize certain TEI-specific idioms in XSLT code, in order to do TEI things really fast. :->

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


Current Thread
Keywords