xsl-list
[Top] [All Lists]

RE: local extremums

2003-03-18 10:58:38
saigo(_at_)nevatravel(_dot_)ru (Evgenia Firsova)
I have a problem with determining local extremums
(precisely - local maximums) of the list.

I mean I need to realize next algorithm:
1. take the list (it is //PoketTourList/Country/Range on 
first iteration)
2. determine the maximum @Cnt of this list
3. cast away this maximum and two his nearest neighbours
4. if line isn't empty than goto step 1
So I need a list with any flag showing Range is local 
extremum or not.
Or I need a way to go throw whole list and determine if each 
Range is local extremum or not on every step.

You can easily determine which element contains the Cnt attribute with the 
highest number using <xsl:sort>. I have written a stylesheet which outputs each 
Range element sorted by @Cnt in descending order. If you want to get only those 
which are *not* among the three highest (assuming no duplicate values among 
them), you need only work with those elements in the result tree with a 
position() value greater than 3.

Tell us what you want to do with the results (e.g., replicate the document 
while leaving out the three Range elements with the highest @Cnt value), and 
I'll refine the stylesheet to do that and post it.

-- 
Charles Knell
cknell(_at_)onebox(_dot_)com - email


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>