re: [xsl] Question on storing Dates for Calendar Items

Subject: re: [xsl] Question on storing Dates for Calendar Items
From: David_Benua@xxxxxxxxxxxxxx
Date: Fri, 23 Mar 2001 03:12:57 -0500
Brian,

I'm using a similar (architecturally) system to yours: we generate XML out of a
relational database and then apply an XSLT stylesheet to it. (Our systems use
Oracle, Java and XT rather than MS SQL, ASP and MSXML, but the concept is  the
same)

My experience has been that you are almost always better off performing the
sorting in the SQL database, both from a simplicity and a performance point of
view.  In addition, if you are generating "pages" (as opposed to larger XML
documents) you are better off selecting the data to display in the SQL database,
rather than doing the same select in XSLT after you process the document.

Unless you tell it otherwise, XSLT always processes the nodes in document order.
If you sort in your SQL statement (e.g. an ORDER BY or GROUP BY clause) you
don't need to do anything at all in your stylesheet.

Of course, the problem of how to set up collating sequences in XSLT is
intellectually interesting, and I hope you get some more responses in that area.
I suspect <xsl:key ...> (which MSXML does not yet support) might help you
somewhat.

Dave Benua
Percussion Software

- -----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: [xsl] 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


Current Thread