xsl-list
[Top] [All Lists]

RE: Release Date vs. Highlight Until Date

2004-09-21 01:37:01
Each news record has a "release date" value.  I am not sure 
of the format but
hopefully my code could handle multiple formats, or if there 
is a standard for
date formatting in XML maybe the CMS uses that.

I would recommend working with the ISO 8601 format which is also used by XML
Schema - this will maximize the chances for interoperability. This is
YYYY-MM-DD.

It's simplest to pass the date to the stylesheet as a parameter. If you
can't do that, another approach is to access it using the document()
function with a URL such as local://date which you intercept in an
XmlResolver, returning an XML document containing the current date.

For date arithmetic, e.g. calculating the date 5 days from now, look at the
EXSLT library at www.exslt.org

Of course it all gets easier with XSLT 2.0 but you appear to have given
yourself platform constraints.

Michael Kay
http://www.saxonica.com/


On a main 
page I need to list
the latest 5 article titles based on this "release date", 
with links to the
article content.  That would seem like a simple sort with 
some kind of break
condition after 5 loops (though I'm not even sure how to do 
that), but the
complication is that each record also has a "highlight until" 
date; if the
current system date is before the "highlight until" date, 
those highlighted
records need to appear at the top of the list, which should still be
constrained to 5 articles.

It seems that XSL doesn't inherently know what date it is, so 
either my CMS
vendor should already be passing that or I need to figure out 
how to pass this
as a parameter to my XSL.  I'm also not finding many web 
references to this
specific kind of date logic.  Based on these I'm wondering if 
a .NET component
is the right way to go, but since the data is already in XML 
I think I would
prefer XSL if possible/not too complicated.

Any assistance would be greatly appreciated.

Thanks,

   -John

--+------------------------------------------------------------------
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>