|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Select single node having highest attribute value
I'm probably losing it being unable to get my head round this one (it's been a long week, and it's only Tuesday...), but maybe somebody can set me right, and then I can leave work and get my dinner :-) I have a set of nodes which are in a random order (simplified example captures all the needful): <blocks> <block priority="23">Something</block> <block priority="-17">Nothing</block> <block priority="29">Anything</block> <block priority="12">Everything</block> </block> I want to apply a template to the node "block" having the highest numeric value for the attribute named "priority", using XSLT 1.0. So in the case above, I'd process <block priority="29">Anything</block>. Something like <xsl:apply-templates select="blocks/block[maximum-value-of(@priority)]" /> would be perfect, but as we know, the world isn't perfect. FYI: I can't use any extension functions (the client doesn't want to take the risk of being stuck in the future, when I'm long gone); The lower and upper bounds for any given dataset cannot be predicted and can be negative; I can't use an XSLT pipeline to pre-order the dataset (they won't change their corporation-wide CMS just for me). Anybody got any ideas? TIA, Nick. -- Nick Fitzsimons http://www.nickfitz.co.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
|

Cart








