xsl-list
[Top] [All Lists]

RE: [xsl] Getting node w/ lowest attribute value

2008-08-16 10:52:19
Cool, thanks Mukul, now how do I get the 2nd lowest? 

-----Original Message-----
From: Mukul Gandhi [mailto:gandhi(_dot_)mukul(_at_)gmail(_dot_)com] 
Sent: Friday, August 15, 2008 1:10 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Getting node w/ lowest attribute value

Please try this,

addresses/address[(@IsActive = 'true') and (@NumOrder =
min(../address[(_at_)IsActive = 'true']/@NumOrder))][1]

This uses the XPath 2.0 function, 'min'.

On Fri, Aug 15, 2008 at 11:22 PM, Bordeman, Chris
<Chris(_dot_)Bordeman(_at_)wolterskluwer(_dot_)com> wrote:
Hi all.

I have some nodes like:

<addresses>
   <address IsActive="false" NumOrder=1>[...]</address>
   <address IsActive="true" NumOrder=3>[...]</address>
   <address IsActive="true" NumOrder=2>[...]</address> </addresses>

How do I get the first address node where IsActive=true AND has the 
lowest value for the NumOrder attribute?

In the above case I'd want the 3rd address node (IsActive="true" and 
NumOrder=2).

Any assistance would be appreciated.  Thanks.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>