reformatted xsl and xhtml to separate out content into xhtml to allow for translation, fix missing text bugs, and reuse existing functions
svn path=/branches/design/; revision=18892
This commit is contained in:
parent
b9a94e4dd0
commit
9cc5aaf277
@ -26,12 +26,78 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<div id="feeds">
|
||||
|
||||
<div id="news" class="section">
|
||||
<h2>
|
||||
<a class="rss-feed" href="/news.rss"><img src="/graphics/rss.png" alt="News RSS" title="news RSS feed" /></a>
|
||||
<a class="ical" href="http://identi.ca/fsfe"><img src="/graphics/identica.png" alt="identica" title="follow FSFE on identi.ca"/></a>
|
||||
|
||||
<a href="/news/news.html">News</a>
|
||||
|
||||
</h2>
|
||||
|
||||
<all-news />
|
||||
|
||||
</div><!--end #news-->
|
||||
|
||||
<text id="news">News</text>
|
||||
<text id="events">Events</text>
|
||||
<text id="morenews">More news…</text>
|
||||
<text id="moreevents">More events…</text>
|
||||
<div id="newsletter" class="section">
|
||||
<h2><a href="/news/newsletter.html">Newsletter</a></h2>
|
||||
|
||||
<div class="entry">
|
||||
<p>
|
||||
<strong>Subscribe to FSFE's monthly newsletter:</strong>
|
||||
</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>
|
||||
</select>
|
||||
|
||||
<input id="email" type="email" placeholder="email" />
|
||||
|
||||
<input type="submit" id="submit" value="Subscribe" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<ul>
|
||||
|
||||
<all-newsletters />
|
||||
|
||||
<li><a href="news/newsletter.html">More...</a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
</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" title="events RSS feed" /></a>
|
||||
<a class="ical" href="webcal://fsfe.org/events/events.ics"><img src="/graphics/ical.png" alt="iCal" title="FSFE events as iCal feed" /></a>
|
||||
|
||||
<a href="/events/events.html">Events</a>
|
||||
|
||||
</h2>
|
||||
|
||||
<all-events />
|
||||
|
||||
</div><!--end #events-->
|
||||
|
||||
</div><!--end #feeds-->
|
||||
|
||||
</body>
|
||||
|
||||
<timestamp>$Date$ $Author$</timestamp>
|
||||
</html>
|
||||
@ -39,4 +105,4 @@
|
||||
Local Variables: ***
|
||||
mode: xml ***
|
||||
End: ***
|
||||
-->
|
||||
-->
|
168
index.xsl
168
index.xsl
@ -5,19 +5,15 @@
|
||||
xmlns:dt="http://xsltsl.org/date-time">
|
||||
|
||||
<xsl:import href="tools/xsltsl/date-time.xsl" />
|
||||
<xsl:import href="tools/xsltsl/tagging.xsl" />
|
||||
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
|
||||
|
||||
<!-- $today = current date (given as <html date="...">) -->
|
||||
<!-- set today variable-->
|
||||
<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>
|
||||
<!-- define content type templates-->
|
||||
|
||||
<!-- Show a single news item -->
|
||||
<xsl:template name="news">
|
||||
@ -39,27 +35,24 @@
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Show a single newsletter entry -->
|
||||
<!-- Show a single news item -->
|
||||
<xsl:template name="newsletter">
|
||||
<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>
|
||||
|
||||
<li><a href="{link}">Newsletter from <xsl:value-of select="$month" /> <xsl:value-of select="$year" /></a></li>
|
||||
<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>
|
||||
|
||||
<div class="text">
|
||||
<xsl:apply-templates select="body/node()" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Show a single event -->
|
||||
@ -130,104 +123,45 @@
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!--define dynamic list of news items-->
|
||||
<xsl:template match="all-news">
|
||||
|
||||
<xsl:call-template name="fetch-news">
|
||||
<xsl:with-param name="tag"></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!--define dynamic list of newsletters items-->
|
||||
<xsl:template match="all-newsletters">
|
||||
|
||||
<!-- 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" title="news RSS feed" /></a>
|
||||
<a class="ical" href="http://identi.ca/fsfe"><img src="/graphics/identica.png" alt="identica" title="follow FSFE on identi.ca"/></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, '-', '') <= translate ($today, '-', '')]">
|
||||
<xsl:sort select="@date" order="descending" />
|
||||
<xsl:if test="position() < 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">
|
||||
<p>
|
||||
<strong>Subscribe to FSFE's monthly newsletter:</strong>
|
||||
</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>
|
||||
</select>
|
||||
|
||||
<xsl:element name="input">
|
||||
<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>
|
||||
|
||||
<input type="submit" id="submit" value="Subscribe" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
<ul>
|
||||
<xsl:for-each select="/html/set/news
|
||||
[translate(@date, '-', '') <= translate($today, '-', '')
|
||||
and (@type = 'newsletter')]">
|
||||
<xsl:sort select="@date" order="descending" />
|
||||
<xsl:if test="position()<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='more']" />...</a></li>
|
||||
</ul>
|
||||
</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" title="events RSS feed" /></a>
|
||||
<a class="ical" href="webcal://fsfe.org/events/events.ics"><img src="/graphics/ical.png" alt="iCal" title="FSFE events as iCal feed" /></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, '-', '') >= translate ($today, '-', '')]">
|
||||
<xsl:sort select="@start" />
|
||||
<xsl:if test="position() < 6">
|
||||
<xsl:call-template name="event" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<xsl:for-each select="/html/set/news [translate(@date, '-', '') <= translate($today, '-', '') and (@type = 'newsletter')]">
|
||||
<xsl:sort select="@date" order="descending" />
|
||||
<xsl:if test="position()<3">
|
||||
<xsl:call-template name="newsletter" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!--define dynamic list of event items-->
|
||||
<xsl:template match="all-events">
|
||||
|
||||
<xsl:call-template name="fetch-events">
|
||||
<xsl:with-param name="tag"></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<!-- Do not copy <set> and <text> to output at all -->
|
||||
<xsl:template match="/html/text" />
|
||||
<xsl:template match="set" />
|
||||
<!-- Do not copy <set> to output at all -->
|
||||
<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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user