[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Comparing multiple dates to display the most recen

Subject: Re: Comparing multiple dates to display the most recent
From: "Joerg Heinicke" <joerg.heinicke@xxxxxx>
Date: Thu, 10 Jan 2002 21:25:55 +0100
multiple dates
The general way is to sort the Requests by date:

<xsl:for-each select="Request[RequestType='MORTGAGE']">
    <xsl:sort select="DateRequested"/>
    <xsl:if test="position() = last()">
        <!-- Do something with the Request -->

But you have the problem, that your date isn't in the correct format to sort
it easily, it has to be YYYYMMDDHHMMSS. So you either can change the XML, if
this is possible for you, or you have to rearrange the string while sorting.
Can you change the XML? This would be the most practicable way, because it's
a bit more difficult to do the second way: you have to replace the months by
it's number values and for this it seems necessary to use the
processor-depending extension-function nodeset().



----- Original Message -----
From: "Katie McNally" <kmcnally9@xxxxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Thursday, January 10, 2002 8:46 PM
Subject:  Comparing multiple dates to display the most recent

> For the XML included below, I would like to display one value for the
> Mortage date (RequestType = MORTGAGE).
> For the example xml below I want to display:
> Mortgage Request Date: 12/23/2001
> Multiple Mortgage dates can be returned in the xml, but only the most
> should be displayed.  If I don't know the number of dates returned (of
> MORTGAGE) ahead of time, how do I determine which date is the most recent
> and then display it?
> XML:
> <Loan>
>   <RequestSet>
>     <Request>
>   <DateRequested>03-Dec-2001 16:55:23</DateRequested>
>   <RequestType>MORTGAGE</RequestType>
>     </Request>
>     <Request>
> <DateRequested>06-Dec-2001 14:33:00</DateRequested>
>   <RequestType>FLOOD</RequestType>
>     </Request>
>     <Request>
> <DateRequested>07-Dec-2001 11:38:00</DateRequested>
>   <RequestType>MORTGAGE</RequestType>
>     </Request>
>     <Request>
> <DateRequested>23-Dec-2001 13:18:00</DateRequested>
>   <RequestType>MORTGAGE</RequestType>
>     </Request>
>     <Request>
> <DateRequested>04-Dec-2001 12:31:00</DateRequested>
>   <RequestType>HAZARD</RequestType>
>     </Request>
>   </RequestSet>
> </Loan>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.