Remove unnecessary variable from XSL stylesheets

This commit is contained in:
Reinhard Müller 2020-04-27 13:00:44 +02:00
parent 7de2583275
commit d07a3c39cb
10 changed files with 31 additions and 55 deletions

View File

@ -71,12 +71,10 @@
<xsl:text>BEGIN:VCALENDAR</xsl:text><xsl:call-template name="nl" />
<xsl:text>VERSION:2.0</xsl:text><xsl:call-template name="nl" />
<xsl:text>PRODID:fsfe.org/events/events.ics.xsl</xsl:text><xsl:call-template name="nl" />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- Future events -->
<xsl:for-each select="/buildinfo/document/set/event[translate (@start, '-', '') &gt;= translate ($today, '-', '')]">
<xsl:for-each select="/buildinfo/document/set/event[
translate(@start, '-', '') &gt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@start" order="descending" />
<xsl:call-template name="event">
<xsl:with-param name="header">current</xsl:with-param>

View File

@ -7,11 +7,6 @@
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="yes"
indent="yes" />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- ============= -->
<!-- Link handling -->
<!-- ============= -->
@ -98,8 +93,9 @@
</image>
<!-- Event items -->
<xsl:for-each select="/buildinfo/document/set/event
[translate (@end, '-', '') &gt;= translate ($today, '-', '')]">
<xsl:for-each select="/buildinfo/document/set/event[
translate(@end, '-', '') &gt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@start" />
<xsl:if test="position() &lt; 11">
<xsl:variable name="start"><xsl:value-of select="@start" /></xsl:variable>

View File

@ -2,7 +2,6 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:import href="fsfe.xsl"/>
<xsl:variable name="today" select="/buildinfo/@date"/>
<!-- ==================================================================== -->
@ -11,7 +10,7 @@
<xsl:template match="dynamic-content-news">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate($today, '-', '')
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending"/>
<xsl:if test="position() &lt;= 3">
@ -159,7 +158,7 @@
<xsl:template match="dynamic-content-events">
<xsl:for-each select="/buildinfo/document/set/event[
translate (@end, '-', '') &gt;= translate ($today, '-', '')
translate (@end, '-', '') &gt;= translate (/buildinfo/@date, '-', '')
]">
<xsl:sort select="@start"/>
<xsl:if test="position() &lt;= 3">

View File

@ -12,11 +12,6 @@
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- ====== -->
<!-- Months -->
<!-- ====== -->
@ -116,7 +111,9 @@
</xsl:element>
<!-- News items -->
<xsl:for-each select="/buildinfo/document/set/news[translate (@date, '-', '') &lt;= translate ($today, '-', '')]">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending"/>
<xsl:if test="position() &lt; 11">
<xsl:element name="item">

View File

@ -15,14 +15,11 @@
<xsl:template match="/buildinfo/document/body/include-news">
<!-- first, include what's in the source file -->
<xsl:apply-templates />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- show news except those in the future -->
<xsl:for-each select="/buildinfo/document/set/news
[translate (@date, '-', '') &lt;= translate ($today, '-', '')]">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending" />
<!-- begin: news entry -->

View File

@ -10,12 +10,9 @@
<xsl:template match="/buildinfo/document/body/include-newsletter">
<xsl:apply-templates />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<xsl:for-each select="/buildinfo/document/set/news[translate(@date,'-','') &lt;= translate($today,'-','')]">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending"/>
<p>
<b><xsl:value-of select="@date" /></b><br/>

View File

@ -16,11 +16,6 @@
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date" />
</xsl:variable>
<!-- ====== -->
<!-- Months -->
<!-- ====== -->
@ -195,7 +190,9 @@
<!-- Podcast episodes -->
<xsl:for-each select="/buildinfo/document/set/news[translate (@date, '-', '') &lt;= translate ($today, '-', '')]">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending"/>
<xsl:element name="item">

View File

@ -4,18 +4,15 @@
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
<!-- $today = current date (given as <html date="...">) -->
<xsl:variable name="today">
<xsl:value-of select="/buildinfo/@date"/>
</xsl:variable>
<!-- Fill dynamic content -->
<xsl:template match="dynamic-content">
<xsl:element name="dl">
<xsl:attribute name="id">press-releases</xsl:attribute>
<!-- Show news except those in the future -->
<xsl:for-each select="/buildinfo/document/set/news[translate(@date,'-','')&lt;=translate($today,'-','')]">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending" />
<!-- A news entry -->

View File

@ -7,14 +7,14 @@
<xsl:import href="../fsfe.xsl" />
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-system="about:legacy-compat" />
<xsl:variable name="today"><xsl:value-of select="/buildinfo/@date" /></xsl:variable>
<!--display dynamic list of news items-->
<xsl:template name="tagged-news" match="tagged-news">
<xsl:element name="ul">
<xsl:attribute name="class">tag list</xsl:attribute>
<xsl:for-each select="/buildinfo/document/set/news[translate(@date, '-', '') &lt;= translate($today, '-', '')]">
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending" />
<xsl:element name="li">

View File

@ -8,7 +8,6 @@
<!--display dynamic list of tagged news items-->
<xsl:template name="fetch-news">
<xsl:param name="today" select="/buildinfo/@date" />
<xsl:param name="nb-items" select="''" />
<xsl:param name="display-year" select="'yes'" />
<xsl:param name="show-date" select="'yes'" />
@ -16,7 +15,7 @@
<xsl:param name="sidebar" select="'no'" />
<xsl:for-each select="/buildinfo/document/set/news[
translate(@date, '-', '') &lt;= translate($today, '-', '')
translate(@date, '-', '') &lt;= translate(/buildinfo/@date, '-', '')
]">
<xsl:sort select="@date" order="descending" />
@ -34,7 +33,6 @@
<!--display dynamic list of tagged event items-->
<xsl:template name="fetch-events">
<xsl:param name="today" select="/buildinfo/@date" />
<xsl:param name="wanted-time" select="future" /> <!-- value in {"past", "present", "future"} -->
<xsl:param name="header" select="''" />
<xsl:param name="nb-items" select="''" />
@ -45,7 +43,7 @@
<xsl:choose> <xsl:when test="$wanted-time = 'past'">
<!-- Past events -->
<xsl:for-each select="/buildinfo/document/set/event[
translate (@end, '-', '') &lt; translate ($today, '-', '')
translate (@end, '-', '') &lt; translate (/buildinfo/@date, '-', '')
]">
<xsl:sort select="@end" order="descending" />
<xsl:if test="position() &lt;= $nb-items or $nb-items=''">
@ -61,8 +59,8 @@
</xsl:when> <xsl:when test="$wanted-time = 'present'">
<!-- Current events -->
<xsl:for-each select="/buildinfo/document/set/event[
translate (@start, '-', '') &lt;= translate ($today, '-', '')
and translate (@end, '-', '') &gt;= translate ($today, '-', '')
translate (@start, '-', '') &lt;= translate (/buildinfo/@date, '-', '')
and translate (@end, '-', '') &gt;= translate (/buildinfo/@date, '-', '')
]">
<xsl:sort select="@start" order="descending" />
<xsl:if test="position() &lt;= $nb-items or $nb-items=''">
@ -78,7 +76,7 @@
</xsl:when> <xsl:otherwise> <!-- if we were not told what to do, display future events -->
<!-- Future events -->
<xsl:for-each select="/buildinfo/document/set/event[
translate (@start, '-', '') &gt; translate ($today, '-', '')
translate (@start, '-', '') &gt; translate (/buildinfo/@date, '-', '')
]">
<xsl:sort select="@start" />
<xsl:if test="position() &lt;= $nb-items or $nb-items=''">