Files
fsfe-website/index.xsl
T

175 lines
5.2 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-09 16:26:28 +00:00
<!--
<div class="text">
2009-02-02 16:36:00 +00:00
<xsl:apply-templates select="body/node()" />
</div>
2010-10-09 16:26:28 +00:00
-->
2009-01-25 14:39:30 +00:00
</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-abbreviation">
<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-abbreviation">
<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="event">
<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-09 16:32:19 +00:00
<p>
<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-09 16:32:19 +00:00
<p>
<span class="day"><xsl:value-of select="$start_day" /></span>
<xsl:text> </xsl:text>
<span class="month"><xsl:value-of select="$start_month" /></span>
2010-01-03 21:05:49 +00:00
<span class="n">)</span>
</p>
</xsl:otherwise>
</xsl:choose>
2010-01-04 19:36:20 +00:00
<div class="details">
<xsl:apply-templates select="body/node()" />
</div>
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-09 15:25:08 +00:00
<div class="grid-50-50">
<div class="box first">
<div id="feed" class="section blue-4">
<!--<h2><a href="/news/news.html"><xsl:value-of select="/html/text[@id='news']"/></a></h2>-->
<div>
<a href="#" class="minibutton mousedown"><span>News</span></a>
<a href="#" class="minibutton"><span>Blogs</span></a>
</div>
<div id="all">
<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>
</div>
<div class="box">
<div id="events" class="section blue-3">
2010-10-09 16:02:08 +00:00
<h2><a href="/events/events.html"><xsl:value-of select="/html/text[@id='events']"/></a></h2>
2010-10-09 15:25:08 +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>
</div>
</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>
</xsl:template>
</xsl:stylesheet>