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

Re: [xsl] Eliminating duplicates while processing


Subject: Re: [xsl] Eliminating duplicates while processing
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Wed, 13 Nov 2002 11:16:44 -0500

José Carlos--

This is best accomplished by using two passes: first sort, then de-duplicate on the sorted order. The two passes can be combined in a single stylesheet if you're willing to use a node-set() extension function to turn a result tree fragment (the sorted node set bound to a variable, say) into a true node set (so it can be traversed).

In XSLT 2.0 the need for the extension function will go away.

In general, since XSLT processing is declarative, functional and side-effect-free, you don't have access to information about what's processed when. In fact, strictly speaking you shouldn't -- XSLT specifies how the output should be arranged, but doesn't specify in what order the processor does anything.

Cheers,
Wendell

At 06:56 AM 11/13/2002, you wrote:
Hi all, I am having the following problem:

I want to process a list of nodes that can appear at several different
points of the structure, and I ant to process them in a particular order.
This is easy to specify:

        for-each select="//node-name"
            sort select="criteria"

The problem is that I want to supress the node's processing if it is equal
to the one that precedes it in that order. How can I have access to the last
processed node while processing the current one?

TIA
jcr


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