[Home] [By Thread] [By Date] [Recent Entries]

Subject: Re: local extremums
From: "Ragulf Pickaxe" <jawxml@xxxxxxxxxxx>
Date: Wed, 19 Mar 2003 09:30:26 +0000
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)
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member