A new XSLT utility, "EXSLT Calendar" 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.

Thanks for this. I'd been wanting to refactor my calendar templates to use EXSLT. I'm looking forward to trying this out. :-)

Good to see Neil's code being used — pretty sure that the place Neil and I worked still uses the same code to generate calendars on it's site!

Edit: Yes, it does —

Very, very nice!

Hey, nice utility, How to do monday first day in a row?

@acidbeast @kanduvisla I’d be interested in that too!

Giel, Could you add the note to the utility to use <xsl:call-template name="calendar"/> to get the full calendar please? noobies might not get it straight away... spent about 30mins figuring it out before I replaced calendar-day call template with Calendar. cheers :) P.S works great now!

Is there a technique to avoid using another page to generate a single day view that isn't in a Table based layout?

I have the <xsl:call-template name="calendar"/> on the page but would like to override the default view if the URL parameter of $date is set/present in the URL. So full Calendar with Table layout when no PARAM, but List view with more detail for when there is a URL PARAM of $date set. make sense?

And then would I use conditional <xsl:choose><xsl:when> etc... in the page template or would I need to override the xslt calendar utility calendar-day part again/slightly differently for a single date view?

EDIT Sorry posted too soon, (again) my url was wrong and I didn't see the $date param output in debug first time round.... all is well :)

@animaux @kanduvisla @acidbeast +1 for monday first, how-to!

For those wanting Monday as first day.. change line 295 in the Utility to:

<xsl:with-param name="day" select="$week * 7 - ($FirstDayInWeekForMonth - 3)"/>

The Number "3" replaces previously used "2".

And then on lines 250, swap the order of the table entries to place Monday first:

                    <th abbr="Monday">Mon</th>
                    <th abbr="Tuesday">Tue</th>
                    <th abbr="Wednesday">Wed</th>
                    <th abbr="Thursday">Thu</th>
                    <th abbr="Friday">Fri</th>
                    <th abbr="Saturday">Sat</th>
                    <th abbr="Sunday">Sun</th>

Hope that's right? if not let me know.

@moonoo2 Sorry, doesn't work for me, removes the td for the second of each month.

To change date to start on Mon, as before swap your dates to the correct order on line 250.

Then replace the 'FirstDayInWeekForMonth' variable with the two new variables below:

<!-- Set the first day in the week: -->
    <xsl:variable name="fdiwfm">
            <xsl:when test="$Month &lt; 10">
                <xsl:value-of select="date:day-in-week(date:date(concat($Year,'-0', $Month, '-01')))"/>
                <xsl:value-of select="date:day-in-week(date:date(concat($Year,'-', $Month, '-01')))"/>

    <xsl:variable name="FirstDayInWeekForMonth"> 
            <xsl:when test="$fdiwfm = 1">7</xsl:when> 
            <xsl:otherwise><xsl:value-of select="$fdiwfm - 1"/></xsl:otherwise> 

It resets the date to the correct position although it would be great to see a EXLST contributor provide a more comprehensive way of doing this.

Thanks jstar, completely missed the fact a day was missing!

No worries, for ANYONE using this default or modified.

    <xsl:when test="$month = 1">January</xsl:when>
    <xsl:when test="$month = 2">February</xsl:when>
    <xsl:when test="$month = 3">May</xsl:when>
    <xsl:when test="$month = 4">April</xsl:when>
    <xsl:when test="$month = 5">March</xsl:when>

You need to change the month May to March and vice versa.

Thank you very much for this! After playing around with the default 'day' template and adding in a bit of AJAX I've very quickly got exactly what I was looking for :)

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