summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@scriptkitty.com>2010-09-12 18:09:00 -0700
committerAlec Warner <antarus@scriptkitty.com>2010-09-12 18:09:00 -0700
commit4dec7f7225172a511ab6f40dd5117c4f6cee1f26 (patch)
tree7836a165e319087939ecbeeecb3cb200a56c411a
parentSplit out newscontent template into newscontent.xsl (diff)
downloadwww-redesign-4dec7f7225172a511ab6f40dd5117c4f6cee1f26.tar.gz
www-redesign-4dec7f7225172a511ab6f40dd5117c4f6cee1f26.tar.bz2
www-redesign-4dec7f7225172a511ab6f40dd5117c4f6cee1f26.zip
Split the function that determines what image we are using into its own template
-rw-r--r--xml/htdocs/xsl/newscontent.xsl94
1 files changed, 51 insertions, 43 deletions
diff --git a/xml/htdocs/xsl/newscontent.xsl b/xml/htdocs/xsl/newscontent.xsl
index e560c986..b9fd65d8 100644
--- a/xml/htdocs/xsl/newscontent.xsl
+++ b/xml/htdocs/xsl/newscontent.xsl
@@ -1,6 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-
+
+
+ <xsl:template name="news-icon-selector">
+ <xsl:param name="category"/>
+ <xsl:choose>
+ <xsl:when test="$category='birthday'">
+ <img class="newsicon" src="/images/birthday_cake.png" alt="Happy Birthday"/>
+ </xsl:when>
+ <xsl:when test="$category='gentoo'">
+ <img class="newsicon" src="/images/icon-gentoo.png" alt="gentoo"/>
+ </xsl:when>
+ <xsl:when test="$category='main'">
+ <img class="newsicon" src="/images/icon-stick.png" alt="stick man"/>
+ </xsl:when>
+ <xsl:when test="$category='linux'">
+ <img class="newsicon" src="/images/icon-penguin.png" alt="tux"/>
+ </xsl:when>
+ <xsl:when test="$category='moo'">
+ <img class="newsicon" src="/images/icon-cow.png" alt="Larry the Cow"/>
+ </xsl:when>
+ <xsl:when test="$category='plans'">
+ <img class="newsicon" src="/images/icon-clock.png" alt="Clock"/>
+ </xsl:when>
+ <xsl:when test="$category='planet'">
+ <img class="newsicon" src="/images/G-Earth.png" alt="Planet Earth"/>
+ </xsl:when>
+ <!-- old ones, kept to display very very old news items -->
+ <xsl:when test="$category='alpha'">
+ <img class="newsicon" src="/images/icon-alpha.gif" alt="AlphaServer GS160"/>
+ </xsl:when>
+ <xsl:when test="$category='kde'">
+ <img class="newsicon" src="/images/icon-kde.png" alt="KDE"/>
+ </xsl:when>
+ <xsl:when test="$category='ibm'">
+ <img class="newsicon" src="/images/icon-ibm.gif" alt="ibm"/>
+ </xsl:when>
+ <xsl:when test="$category='nvidia'">
+ <img class="newsicon" src="/images/icon-nvidia.png" alt="Nvidia"/>
+ </xsl:when>
+ <xsl:when test="$category='freescale'">
+ <img class="newsicon" src="/images/icon-freescale.gif" alt="Freescale Semiconductor"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
<!--
TODO(antarus): What does this actually do? Does anything still use it?
@@ -8,9 +52,9 @@
TODO(antarus): The icon selector should be its own template.
-->
<xsl:template name="newscontent">
- <xsl:param name="thenews"/>
- <xsl:param name="summary"/>
- <xsl:param name="link"/>
+ <xsl:param name="thenews"/>
+ <xsl:param name="summary"/>
+ <xsl:param name="link"/>
<div class="news">
<p class="newshead" lang="en">
@@ -34,45 +78,9 @@
</font>
</p>
- <xsl:choose>
- <xsl:when test="$thenews/@category='birthday'">
- <img class="newsicon" src="/images/birthday_cake.png" alt="Happy Birthday"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='gentoo'">
- <img class="newsicon" src="/images/icon-gentoo.png" alt="gentoo"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='main'">
- <img class="newsicon" src="/images/icon-stick.png" alt="stick man"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='linux'">
- <img class="newsicon" src="/images/icon-penguin.png" alt="tux"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='moo'">
- <img class="newsicon" src="/images/icon-cow.png" alt="Larry the Cow"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='plans'">
- <img class="newsicon" src="/images/icon-clock.png" alt="Clock"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='planet'">
- <img class="newsicon" src="/images/G-Earth.png" alt="Planet Earth"/>
- </xsl:when>
- <!-- old ones, kept to display very very old news items -->
- <xsl:when test="$thenews/@category='alpha'">
- <img class="newsicon" src="/images/icon-alpha.gif" alt="AlphaServer GS160"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='kde'">
- <img class="newsicon" src="/images/icon-kde.png" alt="KDE"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='ibm'">
- <img class="newsicon" src="/images/icon-ibm.gif" alt="ibm"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='nvidia'">
- <img class="newsicon" src="/images/icon-nvidia.png" alt="Nvidia"/>
- </xsl:when>
- <xsl:when test="$thenews/@category='freescale'">
- <img class="newsicon" src="/images/icon-freescale.gif" alt="Freescale Semiconductor"/>
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="news-icon-selector">
+ <xsl:with-param name="category" select="$thenews/@category"/>
+ </xsl:call-template>
<div class="newsitem">
<xsl:choose>