[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: local extremums
> >It sounds like you want to recurse (or iterate) on the list of <Range> > elements in a particular > ><Country> until the list is empty! I must not be understanding you right, > because that > >doesn't give you any result. Unless in line 3 you want to *output* (not > discard) the maximum > >and the two nearest neighbors. > > Sorry for my awful english. > > I need to output every Range one by one and mark those who is local > maxumums (not only one, but every) as bold. > Yes, I suppose I need a recurse function which can do this. It would be helpful if you would provide your expected output. I.e. What is your definition of a local maximum for a given node, and provide an example... Here is some XSL that you may find helpful. It removes the maxium and its two closest sibling nodes (i.e. before and after) of the original list. Hopefully, you can modify this to suit your needs. Note that I believe this requires xslt version 1.1 or higher. <x:variable name="nodes"> <x:for-each select="//PoketTourList/Country/Range"> <x:sort data-type="number" order="descending" select="./@Cnt"/> <x:if test="position() = 1"> <x:variable name="cnt" select="@Cnt"/> <x:variable name="thisNode" select="//PoketTourList/Country/Range[@Cnt = $cnt]"/> <x:variable name="lastNode" select="$thisNode/preceding-sibling::*[1]"/> <x:variable name="nextNode" select="$thisNode/following-sibling::*[1]"/> <x:copy-of select="$lastNode"/> <x:copy-of select="$thisNode"/> <x:copy-of select="$nextNode"/> </x:if> </x:for-each> </x:variable> <x:variable name="excludedNodes"> <x:for-each select="//PoketTourList/Country/Range"> <x:variable name="currentNode" select="."/> <x:choose> <x:when test="$currentNode/@Cnt = $nodes//@Cnt"><!-- do nothing --></x:when> <x:otherwise><x:copy-of select="$currentNode"/></x:otherwise> </x:choose> </x:for-each> </x:variable> <x:copy-of select="$excludedNodes"/> bix XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|