Re: [xsl] HST's answers Re: [xsl] Efficient way to check sequence membership -

Subject: Re: [xsl] HST's answers Re: [xsl] Efficient way to check sequence membership -
From: Dave Pawson <davep@xxxxxxxxxxxxx>
Date: Thu, 3 Mar 2011 07:50:38 +0000
On Thu, 03 Mar 2011 00:06:43 +0000
Michael Kay <mike@xxxxxxxxxxxx> wrote:

> On 02/03/2011 22:00, Henry S. Thompson wrote:
> > I've thought of five ways to do this:
> >
> >   1) tokenise and use "some ...", as in the previous message;
> >   2) Add '|' at the beginning of both $stopPat and the word to be
> >      checked, and use contains;
> >   3) Put a sequence of elements with a 'w' attribute whose value is
> > a stop in $stops, then do boolean($stops/*[@w=$w]);
> >   4) As above, but then define an appropriate key and use
> >       boolean($stops/key('stop',$w));
> >   5) Build a regexp and use match:
> >       concat('^(',$stopPat,')$')
> >
> Your results don't surprise me. For all except (4), the naive 
> implementation is O(n) whereas for (4) it is O(n log n). Now we don't 
> know what n is, but if it's large enough then O(n log n) will always 
> win. The fact that the different O(n) solutions have different 
> multiplying factors is always worth remembering, of course.


Does xslt version next have the member() function Mike?
All these node functions, member seems a fairly obvious one?



-- 

regards 

-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

Current Thread