[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: HST's answers Re: Efficient way to check se
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|