Author:
Nils
Version:
1.0
Release Date:
25 Jan 2010
Category:
Date & Time

Description

This utility accepts a start date and calculates years of copyright, e. g. 2010 or 2005-2010:

<xsl:call-template name="copyright">
    <xsl:with-param name="start" select="2005" />
</xsl:call-template>

This $start parameter is optional.

XSLT

View Raw
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="copyright">
	<xsl:param name="start" select="2010" />
	<xsl:value-of select="$start" />
	<xsl:if test="$this-year != $start">
		<xsl:text>&#8211;</xsl:text>
		<xsl:value-of select="$this-year" />
	</xsl:if>
</xsl:template>

</xsl:stylesheet>

Discuss this XSLT Utility

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