[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: identify lowest value within a range of elements
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 ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|