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

Re: max value

Subject: Re: max value
From: Mike Brown <mike@xxxxxxxx>
Date: Mon, 10 Dec 2001 16:52:06 -0700 (MST)
xsl check max
Charly wrote:
> Hello,
> Is there a way to get the max value .
> 
> something that would look like and returns "11"
> 
> <xsl:template match="values">
>       <xsl:value-of select="max(value)" />
> </xsl:template>
> 
> <values>
>    <value>7</value>
>    <value>11</value>
>    <value>8</value>
>    <value>4</value>
> </values>

Check out exslt.org.

<xsl:template match="values">
  <xsl:choose xmlns:math="http://exslt.org/math">
    <xsl:when test="function-available('math:max')">
      <xsl:value-of select="math:max(value)"/>
    </xsl:when>
    <xsl:otherwise>
      <xsl:choose>
        <xsl:when test="not(value)">NaN</xsl:when>
        <xsl:otherwise>
          <xsl:for-each select="value">
            <xsl:sort data-type="number" order="descending" />
            <xsl:if test="position() = 1">
               <xsl:value-of select="number(.)" />
            </xsl:if>
          </xsl:for-each>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

   - Mike
____________________________________________________________________________
  mike j. brown, fourthought.com  |  xml/xslt: http://skew.org/xml/
  denver/boulder, colorado, usa   |  personal: http://hyperreal.org/~mike/

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


Current Thread
  • max value
    • Charly - Mon, 10 Dec 2001 16:40:40 -0500 (EST)
      • Mike Brown - Mon, 10 Dec 2001 18:50:54 -0500 (EST) <=
      • <Possible follow-ups>
      • Joshua . Kuswadi - Mon, 10 Dec 2001 18:50:04 -0500 (EST)
      • Jeff Beadle - Tue, 11 Dec 2001 09:21:10 -0500 (EST)
        • Charly - Tue, 11 Dec 2001 11:01:00 -0500 (EST)
      • Mark Miller - Tue, 11 Dec 2001 11:19:54 -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.