RE: Question on storing Dates for Calendar Items
I like your idea of breaking the date into Day/Month/Year and xsl:sort on Year, then Month, then Day? To sort the months, a way to make this easier would be to assign each a numeric attribute <month name="Jan" value="1" /> <month name="Feb" value="2" /> <month name="Mar" value="3" /> <month name="Apr" value="4" /> <month name="May" value="5" /> <month name="Jun" value="6" /> <month name="Jul" value="7" /> <month name="Aug" value="8" /> <month name="Sep" value="9" /> <month name="Oct" value="10" /> <month name="Nov" value="11" /> <month name="Dec" value="12" /> I would be interested to see other ways of doing this, and hope you get a few posts with other methods Tim Watts -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of Gollwitzer Brian Contr ESC/JS Sent: Wednesday, 21 March 2001 11:42 AM To: 'XSL-List@xxxxxxxxxxxxxxxxxxxxxx' Subject: Question on storing Dates for Calendar Items I'm currently using ODBC and ASP to serve up calendar information in a table/list format. The table consists of two columns, Event Description and Event Date and is sorted by Event Date. The Event Date is stored in the DB as a Date Data Type. Using ASP I create the XML file and it looks like below. <?xml version='1.0'?> <calendar_items> <item> <description>Event 1</description> <date>12-Feb-01</date> </item> <item> <description>Event 2</description> <date>14-Mar-01</date> </item> </calendar_items> ----->However<--------- If I perform an xsl:sort it has no idea the information is a date and incorrectly sorts the information. --------->So<---------- What I'm wondering is 1. What is a good way to store this date information so it can be easily sorted. Would it be worth it to break the date into Day/Month/Year and xsl:sort on Year, then Month, then Day? I know I could just sort the data server-side before writing it to the XML file and xsl:for-each running through them in order knowing they are already sorted but I'd like ot know if there is another way. > Brian Gollwitzer > Joint STARS Program Office > DSN: 478-6769 / Comm (781) 377-3952 > FAX: 478-1547 / Comm (781) 377-1547 > Email: Gollwitzerb@xxxxxxxxxxxxxx > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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