Files
fsfe-website/index.xsl
T

256 lines
7.6 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-09 16:32:19 +00:00
<!--
2010-10-09 16:26:28 +00:00
<p><xsl:value-of "html/@newsdate" /></p>
2010-10-09 16:32:19 +00:00
-->
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">
<xsl:variable name="link"><xsl:value-of select="link" /></xsl:variable>
<li><a href="{link}"><xsl:value-of select="@date" /></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>
2010-10-14 14:38:56 +00:00
<a class="rss-feed" href="/news.rss"><img src="/graphics/rss.png" alt="News RSS" /></a>
<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" />
o <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-11-12 17:58:02 +00:00
2010-11-12 16:43:04 +00:00
<!--
2010-11-12 15:38:03 +00:00
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/html/body">
<body>
<xsl:apply-templates />
2010-11-12 16:59:44 +00:00
$today = current date (given as <html date="...">)
<xsl:variable name="today">
<xsl:value-of select="/html/@date" />
</xsl:variable>
<xsl:for-each select="/html/set/news[translate(@date,'-','') &lt;= translate($today,'-','')]">
2010-11-12 16:43:04 +00:00
<xsl:sort select="@date" order="descending" />
<p>
2010-11-12 16:43:04 +00:00
<xsl:value-of select="body"/>
<xsl:variable name="link"><xsl:value-of select="link"/></xsl:variable>
<xsl:if test="$link!=''">
[<a href="{link}"><xsl:value-of select="/html/text[@id='more']"/>]</a>
</xsl:if>
</p>
<p class="date">
<xsl:value-of select="@date" />
</p>
</xsl:for-each>
</body>
</xsl:template>
2010-11-12 16:43:04 +00:00
-->
2010-11-12 16:43:04 +00:00
<!--
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="set"/>
2010-11-12 16:43:04 +00:00
<xsl:template match="text"/>
-->
2010-10-14 14:38:56 +00:00
<p>
Subscribe to FSFE's monthly newsletter
2010-10-14 14:38:56 +00:00
</p>
<form method="post" action="http://mail.fsfeurope.org/mailman/subscribe/press-release">
<p>
<select>
<option selected="selected">English</option>
<option>Deutsch</option>
<option>Italiano</option>
<option>Svenska</option>
</select>
<input type="image" src="/graphics/email-button.png" />
<input name="email" type="email" placeholder="address" />
2010-11-10 13:11:06 +00:00
2010-11-12 16:03:31 +00:00
<input type="submit" value="Subscribe" />
2010-10-14 14:38:56 +00:00
</p>
</form>
2010-11-12 17:58:02 +00:00
<ul>
<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>
2010-11-12 17:58:02 +00:00
</xsl:for-each>
</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>
2010-10-14 14:38:56 +00:00
<a class="rss-feed" href="/events.rss"><img src="/graphics/rss.png" alt="Events RSS" /></a>
<a class="ical" href="/events.ical"><img src="/graphics/ical.png" alt="iCal" /></a>
<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>