[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: local extremums

Subject: Re: local extremums
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Wed, 19 Mar 2003 09:30:26 +0000
finding all local extremums
Hi again,

I think this has a slight better chance of success :)
The most important thing is to change value-of() with number() as the first gives the string value, the last it's numerical value (better for finding extrema).


If there is something wrong with this code, I would like to hear it myself.

<xsl:template
match="Range[number(@Cnt)&gt;number(./previous-sibling/@Cnt) and
number(@Cnt)&lt;value-of(./next-sibling/@Cnt)]">
 <xsl:call-template name="IsLocalMaximum"/>
</xsl:template>

<xsl:template
match="Range[not(number(@Cnt)&gt;number(./previous-sibling/@Cnt)
and number(@Cnt)&lt;value-of(./next-sibling/@Cnt))]">
<xsl:choose>
</xsl:when test="position()=1 and number(@Cnt)&gt;number(./next-sibling/@Cnt)]><xsl:call-template name="IsLocalMaximum"/><xsl:when>
</xsl:when test="position()=last() and number(@Cnt)&lt;number(./previous-sibling/@Cnt)]><xsl:call-template name="IsLocalMaximum"/><xsl:when>
<xsl:otherwise><xsl:call-template name="IsNotLocalMaximum"/></xsl:otherwise>
</xsl:choose>
</xsl:template>


<xsl:template name="IsLocalMaximum">
 <!-- Do your stuff here -->
</xsl:template>

<xsl:template name="IsNotLocalMaximum">
 <!-- Do your other stuff here -->
</xsl:template>

Ragulf

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



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



Current Thread
  • RE: local extremums, (continued)
    • cknell - Tue, 18 Mar 2003 12:55:37 -0500 (EST)
    • Evgenia Firsova - Wed, 19 Mar 2003 01:13:31 -0500 (EST)
      • bix_xslt - Wed, 19 Mar 2003 02:37:44 -0500 (EST)
    • Ragulf Pickaxe - Wed, 19 Mar 2003 03:36:00 -0500 (EST)
    • Ragulf Pickaxe - Wed, 19 Mar 2003 04:27:25 -0500 (EST) <=
    • cknell - Wed, 19 Mar 2003 09:09:26 -0500 (EST)
      • TP - Wed, 19 Mar 2003 09:31:07 -0500 (EST)
        • TP - Wed, 19 Mar 2003 09:54:17 -0500 (EST)

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.