A new XSLT utility, "Get the next day of a date" 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.

Wouldn't this the be much simpler using EXSLT's date functions? (And leap years would also work!)

This stylesheet can give you a start:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"

<xsl:output method="xml"
    indent="yes" />

<xsl:template match="/">
    <xsl:param name="date" select="'2012-02-28'"/>
            <xsl:value-of select="$date"/>
            <xsl:value-of select="date:add($date, 'P1D')"/>
            <xsl:value-of select="date:add($date, 'P2D')"/>


The output will be:


[EDIT]: Simplified stylesheet.

I see it as a challenge. Here is the latest version with leap year.


I was wondereing why it didn’t work in my case just now. I borked up the namespace … thanks to this page I found the error :) thanks Michael!

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