A new XSLT utility, “Date utilities” is now available for download. Comments and feedback can be left here but if you discover any issues, please post it on the issue tracker.

Submitted a bug. Ciao :)

Date utilities updated to version 0.1.1 on 5th of December 2010

Ciao @eKoeS

I'd like to use your utility to test if a date in my XML output is earlier than today. The reason I'm not using a data source for this is that my date is stored in a text input so the "earlier than today" filter will not work.

So the XML looks like this:

         <mc-paid-until handle="2011-12-09">2011-12-09</mc-paid-until>

What I'd like to do is to use a choose statement to show a payment form if the $today parameter is later than the value of mc-paid-until or to show a welcome message if $today is the same as or earlier than mc-paid-until.

Is this something the utility can do? If so, please could you suggest what the syntax would be.

Grazie :-)

I've not used this before but looking at the example it should be possible. The date-compare template returns -1, 0 or 1 depending on whether the dates are before, equal or later than one another. You can put this result into a variable then run tests against it:

<xsl:variable name="is-later">
    <xsl:call-template name="date-compare">
        <xsl:with-param name="first" select="mc-paid-until"/>
        <xsl:with-param name="second" select="$today"/>

    <xsl:when test="$is-later &gt; 1">
        <!-- date is later -->
        <!-- date is earlier -->

Not sure if I got the order the right way around, but the concept should work.

Ciao Stuart :)

Nick got it right, except for the test condition that should probably be:

$is-later = 1


$is-later &gt; 0


Thanks again Nick. Grazie Simone. Tutto va bene :-)

Is there scope for equal to or earlier and equal to or later condition to be added to the utility at all?

Or has this been addressed?

I have a ticketing url that I only want to show once the date of tickets is upon us. At present I can only show the xsl before or after the date, not on the date.

Is this valid xpath? <xsl:when test="not($is-later >= 1)">

Looking at this in stackoverflow for ideas

What a dumb ass! Just add another when expression for = 0. Sorted, ignore me, as always :)

Arrrrgh, I completely missed to ignore you. That won't happen again! :-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details