copyright.years

copyright.years — Print a set of years with collapsed ranges

Synopsis

<xsl:template name="copyright.years">
<xsl:param name="years"/>
<xsl:param name="print.ranges" select="1"/>
<xsl:param name="single.year.ranges" select="0"/>
<xsl:param name="firstyear" select="0"/>
<xsl:param name="nextyear" select="0"/>
  ...
</xsl:template>

Description

This template prints a list of year elements with consecutive years printed as a range. In other words:

<year>1992</year>
<year>1993</year>
<year>1994</year>

is printed 1992-1994, whereas:

<year>1992</year>
<year>1994</year>

is printed 1992, 1994.

This template assumes that all the year elements contain only decimal year numbers, that the elements are sorted in increasing numerical order, that there are no duplicates, and that all the years are expressed in full century+year (1999 not 99) notation.

Parameters

years

The initial set of year elements.

print.ranges

If non-zero, multi-year ranges are collapsed. If zero, all years are printed discretely.

single.year.ranges

If non-zero, two consecutive years will be printed as a range, otherwise, they will be printed discretely. In other words, a single year range is 1991-1992 but discretely it's 1991, 1992.

Returns

This template returns the formatted list of years.