I have a calendar of events. I'm using XSLT to count all events which occur on or after a particular date, but it always returns zero when I do this:
<xsl:variable name="eventsToday" select="count($currentPage/descendant::*
[@isDoc and (name()='Production' or name()='EventItem') and
(umbraco.library:FormatDateTime(./startDateTime, 'dd/MM/yyyy') >=
'02/10/2010')])" />
However, when I change the operator from >= to just = it does pick up the event on this particular day:
<xsl:variable name="eventsToday" select="count($currentPage/descendant::*
[@isDoc and (name()='Production' or name()='EventItem') and
(umbraco.library:FormatDateTime(./startDateTime, 'dd/MM/yyyy') =
'02/10/2010')])" />
I've tried using umbraco.library:FormatDateTime on the hard-coded date, but it makes no difference - it just seems that dates can't be subject to 'less than' or 'greater than' operators in XSLT. Is this true?
Thanks Sebastian/Powellze. I've ended up using the 'DateGreaterThanOrEqual' XSLT extension as it feels a little more solid than formatting dates as numbers (which I've no doubt works too though!) Somehow I'd missed those extensions in the documentation.
Selecting all nodes where date greater than value
Hi,
I have a calendar of events. I'm using XSLT to count all events which occur on or after a particular date, but it always returns zero when I do this:
However, when I change the operator from >= to just = it does pick up the event on this particular day:
I've tried using umbraco.library:FormatDateTime on the hard-coded date, but it makes no difference - it just seems that dates can't be subject to 'less than' or 'greater than' operators in XSLT. Is this true?
Can anyone see how to rectify this?
Thanks
Format the date as 20101002 (maybe you'll have to convert it to a number in XSLT) and then you can do greater or less just fine! :)
An old XSLT I have which might serve as a good example for the Umbraco Library GreaterThan:
Here is the umbraco library which lists all the date greater than etc....
http://our.umbraco.org/wiki/reference/umbracolibrary
Thanks Sebastian/Powellze. I've ended up using the 'DateGreaterThanOrEqual' XSLT extension as it feels a little more solid than formatting dates as numbers (which I've no doubt works too though!) Somehow I'd missed those extensions in the documentation.
is working on a reply...