|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Node with maximum attribute value
At 17:50 21/02/00 -0000, "Richard Birkby" <rbirkby@xxxxxxxxxxxxxxx> wrote:
>I want to find the maximum mid attribute from the node-set. My
>first idea was to use a sorted for-each, and assign a variable to the
>maximum value, however variables cannot be reassigned. Is there another
>way? Thanks, Richard
This is the best I came up with when I encountered a similar problem. It
seems pretty gross to have to sort the whole list just to find a maximum,
though. If anyone knows a better way...
<xsl:variable name="maxmid">
<xsl:for-each select="closing-price">
<xsl:sort select="number(@mid)" data-type="number" order="descending"/>
<xsl:if test="position()=1">
<xsl:value-of select="number(@mid)"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
--
Cheers,
John
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








