| Subject: Re: [xsl] identify lowest value within a range of elements From: David Carlisle <davidc@xxxxxxxxx> Date: Fri, 26 May 2006 12:41:51 +0100 | 
I wrote: 
   something like
   <xsl:template match="price">
   <xsl:param name="range" select="../price"/>
   <xsl:param name="rangename" select="'default'"/>
   <xsl:copy>
   <xsl:if test="empty($range[number(.) < number(current())])">
   <xsl:attribute name="lowest" select="$rangename"/>
   </xsl:if>
   <xsl:copy-of select="node()"/>
   </xsl:copy>
   </xsl:template>
   and
   <xsl:apply-templates select="price">
     <xsl:with-param name="rangename" select="'range1'"/>
     <xsl:with-param name="range" select="price[position[< 5]"/>
   </xsl:apply-templates>
That redoes the search for the lowest value each cell which isn't very
sensible, better would be
   something like
   <xsl:template match="price">
   <xsl:param name="lowest" select="0"/>
   <xsl:param name="rangename" select="'default'"/>
   <xsl:copy>
   <xsl:if test="[$lowest= number(current())])">
   <xsl:attribute name="lowest" select="$rangename"/>
   </xsl:if>
   <xsl:copy-of select="node()"/>
   </xsl:copy>
   </xsl:template>
   and
   <xsl:apply-templates select="price">
     <xsl:with-param name="rangename" select="'range1'"/>
     <xsl:with-param name="lowest" select="min(price[position()< 5]/number(.))"/>
   </xsl:apply-templates>
David
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] identify lowest value wit, David Carlisle | Thread | RE: [xsl] identify lowest value wit, Kevin Bird \(Matrix\ | 
| Re: [xsl] identify lowest value wit, David Carlisle | Date | RE: [xsl] identify lowest value wit, Kevin Bird \(Matrix\ | 
| Month |