Files
fsfe-website/index.xsl
T

233 lines
7.7 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
2003-02-01 10:01:49 +00:00
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2010-01-03 01:41:27 +00:00
xmlns:dt="http://xsltsl.org/date-time">
2010-02-11 14:40:11 +00:00
<xsl:import href="tools/xsltsl/date-time.xsl" />
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
2003-02-01 10:01:49 +00:00
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/html/@date" />
</xsl:variable>
<!-- Basically, copy everything -->
2003-02-01 10:01:49 +00:00
<xsl:template match="/">
2010-01-12 16:51:34 +00:00
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
2010-02-11 14:59:12 +00:00
</xsl:template>
<!-- Show a single news item -->
<xsl:template name="news">
2010-01-03 21:05:49 +00:00
<xsl:variable name="link"><xsl:value-of select="link" /></xsl:variable>
<div class="entry">
2010-01-03 20:53:49 +00:00
<xsl:choose>
<xsl:when test="$link != ''">
<h3><a href="{link}"><xsl:value-of select="title" /></a></h3>
</xsl:when>
<xsl:otherwise>
<h3><xsl:value-of select="title" /></h3>
</xsl:otherwise>
</xsl:choose>
2010-10-13 14:22:41 +00:00
<div class="text">
2009-02-02 16:36:00 +00:00
<xsl:apply-templates select="body/node()" />
</div>
2010-10-13 14:22:41 +00:00
2009-01-25 14:39:30 +00:00
</div>
</xsl:template>
2010-11-12 17:58:02 +00:00
<!-- Show a single newsletter entry -->
<xsl:template name="newsletter">
2010-11-12 20:54:01 +00:00
<xsl:variable name="date">
<xsl:value-of select="@date" />
</xsl:variable>
<xsl:variable name="link">
<xsl:value-of select="link" />
</xsl:variable>
<xsl:variable name="month">
<xsl:call-template name="dt:get-month-name">
<xsl:with-param name="month" select="substring($date,6,2)" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="year">
<xsl:value-of select="substring($date,0,5)" />
</xsl:variable>
2010-11-12 20:54:01 +00:00
<li><a href="{link}">Newsletter from <xsl:value-of select="$month" />&#160;<xsl:value-of select="$year" /></a></li>
2010-11-12 17:58:02 +00:00
</xsl:template>
<!-- Show a single event -->
<xsl:template name="event">
<!-- Create variables -->
<xsl:variable name="start">
<xsl:value-of select="@start" />
</xsl:variable>
<xsl:variable name="start_day">
<xsl:value-of select="substring($start,9,2)" />
</xsl:variable>
<xsl:variable name="start_month">
2010-10-09 16:44:05 +00:00
<xsl:call-template name="dt:get-month-name">
<xsl:with-param name="month" select="substring($start,6,2)" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="end">
<xsl:value-of select="@end" />
</xsl:variable>
<xsl:variable name="end_day">
<xsl:value-of select="substring($end,9,2)" />
</xsl:variable>
<xsl:variable name="end_month">
2010-10-09 16:44:05 +00:00
<xsl:call-template name="dt:get-month-name">
<xsl:with-param name="month" select="substring($end,6,2)" />
</xsl:call-template>
</xsl:variable>
<xsl:variable name="link">
<xsl:value-of select="link" />
</xsl:variable>
2010-10-13 13:44:53 +00:00
<div class="entry">
<xsl:choose>
2010-01-03 21:05:49 +00:00
<xsl:when test="$link != ''">
<h3><a href="{link}"><xsl:value-of select="title" /></a></h3>
</xsl:when>
<xsl:otherwise>
<h3><xsl:value-of select="title" /></h3>
</xsl:otherwise>
</xsl:choose>
2010-01-03 21:05:49 +00:00
<xsl:choose>
<xsl:when test="$start != $end">
2010-10-13 14:05:22 +00:00
<p class="date">
2010-10-09 16:32:19 +00:00
<xsl:value-of select="$start_day" />
2010-01-04 20:18:46 +00:00
<xsl:text> </xsl:text>
2010-10-09 16:32:19 +00:00
<xsl:value-of select="$start_month" />
<xsl:text> to </xsl:text>
<xsl:value-of select="$end_day" />
2010-01-04 20:18:46 +00:00
<xsl:text> </xsl:text>
2010-10-09 16:32:19 +00:00
<xsl:value-of select="$end_month" />
2010-01-03 21:05:49 +00:00
</p>
</xsl:when>
<xsl:otherwise>
2010-10-13 14:05:22 +00:00
<p class="date">
2010-10-09 16:34:33 +00:00
<xsl:value-of select="$start_day" />
<xsl:text> </xsl:text>
2010-10-09 16:34:33 +00:00
<xsl:value-of select="$start_month" />
2010-01-03 21:05:49 +00:00
</p>
</xsl:otherwise>
</xsl:choose>
2009-01-25 14:39:30 +00:00
</div>
</xsl:template>
2003-02-01 10:01:49 +00:00
<!-- In /html/body node, append dynamic content -->
2003-02-01 10:01:49 +00:00
<xsl:template match="/html/body">
<body>
<xsl:apply-templates />
2010-02-11 15:57:10 +00:00
2010-10-10 13:02:50 +00:00
<div id="feeds">
2010-10-10 15:04:06 +00:00
<div id="news" class="section">
2010-10-10 16:34:36 +00:00
<h2>
<a class="rss-feed" href="/news.rss"><img src="/graphics/rss.png" alt="News RSS" title="news RSS feed" /></a>
2010-11-19 15:38:05 +00:00
<a class="ical" href="http://identi.ca/fsfe"><img src="/graphics/identica.png" alt="identica" title="follow FSFE on identi.ca"/></a>
2010-10-14 14:38:56 +00:00
<a href="/news/news.html"><xsl:value-of select="/html/text[@id='news']"/></a>
</h2>
2010-10-09 15:25:08 +00:00
2010-10-10 15:04:06 +00:00
<xsl:for-each select="/html/set/news[translate (@date, '-', '') &lt;= translate ($today, '-', '')]">
<xsl:sort select="@date" order="descending" />
<xsl:if test="position() &lt; 6">
2010-10-10 15:04:06 +00:00
<xsl:call-template name="news" />
</xsl:if>
</xsl:for-each>
</div>
2010-10-14 14:38:56 +00:00
<div id="newsletter" class="section">
2010-10-10 15:04:06 +00:00
<h2><a href="/news/newsletter.html">Newsletter</a></h2>
2010-10-13 13:13:15 +00:00
<div class="entry">
2010-10-14 14:38:56 +00:00
<p>
2010-11-22 17:47:30 +00:00
<strong>Subscribe to FSFE's monthly newsletter:</strong>
2010-10-14 14:38:56 +00:00
</p>
<form method="post" action="http://mail.fsfeurope.org/mailman/subscribe/press-release">
<p>
<select id="language" name="language">
<option value="en" selected="selected">English</option>
<option value="el">Ελληνικά</option>
<option value="es">Español</option>
<option value="de">Deutsch</option>
<option value="fr">Français</option>
<option value="it">Italiano</option>
<option value="nl">Nederlands</option>
<option value="pt">Português</option>
<option value="ru">Русский</option>
<option value="sv">Svenska</option>
2010-10-14 14:38:56 +00:00
</select>
<xsl:element name="input">
2010-11-18 13:29:36 +00:00
<xsl:attribute name="id">email</xsl:attribute>
<xsl:attribute name="type">email</xsl:attribute>
<xsl:attribute name="placeholder"><xsl:value-of select="/buildinfo/textset/text[@id='email-address-label']" /></xsl:attribute>
</xsl:element>
2010-11-10 13:11:06 +00:00
<input type="submit" id="submit" value="Subscribe" />
2010-10-14 14:38:56 +00:00
</p>
</form>
2010-11-12 17:58:02 +00:00
<ul>
2010-11-19 13:20:06 +00:00
<xsl:for-each select="/html/set/news
[translate(@date, '-', '') &lt;= translate($today, '-', '')
and (@type = 'newsletter')]">
<xsl:sort select="@date" order="descending" />
<xsl:if test="position()&lt;3">
<xsl:call-template name="newsletter" />
</xsl:if>
</xsl:for-each>
<li><a href="news/newsletter.html"><xsl:value-of select="/buildinfo/textset/text[@id='email-address-label']" />...</a></li>
2010-11-12 17:58:02 +00:00
</ul>
2010-10-14 14:38:56 +00:00
</div><!-- /.entry -->
</div> <!-- /#newsletter -->
2010-10-10 15:04:06 +00:00
<div id="events" class="section">
2010-10-10 16:34:36 +00:00
<h2>
<a class="rss-feed" href="/events.rss"><img src="/graphics/rss.png" alt="Events RSS" title="events RSS feed" /></a>
2010-11-19 14:57:27 +00:00
<a class="ical" href="/events.ical"><img src="/graphics/ical.png" alt="iCal" title="FSFE events as iCal feed" /></a>
2010-10-14 14:38:56 +00:00
<a href="/events/events.html"><xsl:value-of select="/html/text[@id='events']"/></a>
</h2>
2010-10-10 13:02:50 +00:00
2010-10-10 15:04:06 +00:00
<xsl:for-each select="/html/set/event
[translate (@end, '-', '') &gt;= translate ($today, '-', '')]">
<xsl:sort select="@start" />
<xsl:if test="position() &lt; 6">
<xsl:call-template name="event" />
</xsl:if>
</xsl:for-each>
</div>
2010-10-09 15:25:08 +00:00
</div>
2003-02-01 10:01:49 +00:00
</body>
</xsl:template>
<!-- Do not copy <set> and <text> to output at all -->
<xsl:template match="/html/text" />
<xsl:template match="set" />
<!-- For all other nodes, copy verbatim -->
2003-02-01 10:01:49 +00:00
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
2010-11-12 16:21:26 +00:00
2003-02-01 10:01:49 +00:00
</xsl:template>
2010-11-12 16:21:26 +00:00
2010-11-12 15:43:53 +00:00
</xsl:stylesheet>