Files
fsfe-website/index.xsl
samtuke 07f5e81c1c fixed comment bug
svn path=/branches/design/; revision=18253
2010-11-12 15:38:03 +00:00

230 lines
7.0 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="http://xsltsl.org/date-time">
<xsl:import href="tools/xsltsl/date-time.xsl" />
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/html/@date" />
</xsl:variable>
<!-- Basically, copy everything -->
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
<!-- Show a single news item -->
<xsl:template name="news">
<xsl:variable name="link"><xsl:value-of select="link" /></xsl:variable>
<div class="entry">
<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>
<!--
<p><xsl:value-of "html/@newsdate" /></p>
-->
<div class="text">
<xsl:apply-templates select="body/node()" />
</div>
</div>
</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">
<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">
<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>
<div class="entry">
<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>
<xsl:choose>
<xsl:when test="$start != $end">
<p class="date">
<xsl:value-of select="$start_day" />
<xsl:text> </xsl:text>
<xsl:value-of select="$start_month" />
<xsl:text> to </xsl:text>
<xsl:value-of select="$end_day" />
<xsl:text> </xsl:text>
<xsl:value-of select="$end_month" />
</p>
</xsl:when>
<xsl:otherwise>
<p class="date">
<xsl:value-of select="$start_day" />
<xsl:text> </xsl:text>
<xsl:value-of select="$start_month" />
</p>
</xsl:otherwise>
</xsl:choose>
</div>
</xsl:template>
<!-- In /html/body node, append dynamic content -->
<xsl:template match="/html/body">
<body>
<xsl:apply-templates />
<div id="feeds">
<div id="news" class="section">
<h2>
<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>
<xsl:for-each select="/html/set/news[translate (@date, '-', '') &lt;= translate ($today, '-', '')]">
<xsl:sort select="@date" order="descending" />
<xsl:if test="position() &lt; 6">
<xsl:call-template name="news" />
</xsl:if>
</xsl:for-each>
</div>
<div id="newsletter" class="section">
<h2><a href="/news/newsletter.html">Newsletter</a></h2>
<div class="entry">
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/html/body">
<body>
<xsl:apply-templates />
<!-- $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,'-','')]">
<xsl:sort select="@date" order="descending"/>
<p>
<b><xsl:value-of select="@date" /></b><br/>
<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>
</xsl:for-each>
</body>
</xsl:template>
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="set"/>
<xsl:template match="text"/> -->
<p>
Subscribe to FSFE's monthly newsletter
</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" />
<!--<input type="submit" value="Subscribe" />-->
</p>
</form>
</div><!-- /.entry -->
</div> <!-- /#newsletter -->
<div id="events" class="section">
<h2>
<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>
<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>
</div>
</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 -->
<xsl:template match="@*|node()" priority="-1">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>