Re: [xsl] Getting a distinct list of node names

Subject: Re: [xsl] Getting a distinct list of node names
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Tue, 16 Dec 2003 15:39:42 -0500
Hi David,

At 03:15 PM 12/16/2003, you wrote:
> > > node:definition/*[not(name() = name(preceding-sibling::*))]
> >
> >Why should this take a long time?  Isn't this the same as
> >
> >*[not(name() = name(preceding-sibling::*[last()]))]
>
> preceding-sibling::*[last()]), which therefore won't de-duplicate properly.
>
> So it won't take a long time, and it won't work either.

But is there a way to express it as a single predicate? I mean, not equal to the name
of any preceding-sibling? Just out of curiousity.

I don't believe so, in XPath 1.0, since we have to test one value (the name of the context node) against many values (the names of the other nodes in the set) ... and while the equality rule for node sets allows us to do such a test, there's no way to get the set of names we want into a node set for testing.


This can presumably, however, be done in XPath 2.0, since it can create sequences on the fly.

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