Subject: [xsl] Select single node having highest attribute value From: "Nick Fitzsimons" <nick@xxxxxxxxxxxxxx> Date: Tue, 18 Oct 2005 18:51:32 +0100 (BST) |
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/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using absolute path when , andrew welch | Thread | Re: [xsl] Select single node having, Jon Gorman |
Re: [xsl] Using absolute path when , Colin Paul Adams | Date | [xsl] RE : [xsl] xsl:sort blocks of, Stephane Dion |
Month |