EXSLT - math:highest - Use Case 7

Category: example
XML Definition: math.highest.xml
Function or Template: function

Use Case

Source (view)

<sales>
   <sale id="1"
         qty="10"
         price="15.00" />
   <sale id="2"
         qty="2"
         price="12.00" />
   <sale id="3"
         qty="1"
         price="10.00" />
   <sale id="4"
         qty="2"
         price="5.00" />
   <sale id="5"
         qty="2"
         price="15.00" />
   <sale id="6"
         qty="2"
         price="8.00" />
   <sale id="7"
         qty="2"
         price="5.00" />
</sales>

Stylesheet (view)

<xsl:template match="/"
              xmlns:math="http://exslt.org/math">
   <out>

        *       <lowest-prices>
         <xsl:for-each select="math:lowest(//sale/@price)">
            <xsl:value-of select="../@id" />
;
        
         </xsl:for-each>
      </lowest-prices>

        *       <highest-prices>
         <xsl:for-each select="math:highest(//sale/@price)">
            <xsl:value-of select="../@id" />
;
        
         </xsl:for-each>
      </highest-prices>
   </out>
</xsl:template>

Result (view)

<out xmlns:math="http://exslt.org/math">

        *    <lowest-prices>4;
        7;
        </lowest-prices>

        *    <highest-prices>1;
        5;
        </highest-prices>
</out>

Change History

Previous Version: ..NaN.html

VersionModifiedByDetails
12001-04-28Mike Kay

Tests functionality of math:lowest() and math:highest().

http://www.exslt.org/math/functions/highest/math.highest.use-case.7.html last modified 2001-04-28