128 lines
4.6 KiB
XML
128 lines
4.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||
<xsl:import href="../fsfe.xsl"/>
|
||
|
||
|
||
<!-- ==================================================================== -->
|
||
<!-- Display the author(s) of the news item -->
|
||
<!-- ==================================================================== -->
|
||
|
||
<xsl:template match="buildinfo/document/set/news/author">
|
||
<xsl:variable name="id" select="@id"/>
|
||
<!-- if author is in fsfe's people.xml, take information from there -->
|
||
<xsl:choose>
|
||
<!-- author is in people.en.xml -->
|
||
<xsl:when test="@id and document('../about/people/people.en.xml')/personset/person[@id=$id]">
|
||
<xsl:choose>
|
||
<!-- person has a link -->
|
||
<xsl:when test="document('../about/people/people.en.xml')/personset/person[@id=$id]/link">
|
||
<a rel="author" href="{document('../about/people/people.en.xml')/personset/person[@id=$id]/link}">
|
||
<xsl:value-of select="document('../about/people/people.en.xml')/personset/person[@id=$id]/name"/>
|
||
</a></xsl:when>
|
||
<!-- person has no link -->
|
||
<xsl:otherwise>
|
||
<span>
|
||
<xsl:value-of select="document('../about/people/people.en.xml')/personset/person[@id=$id]/name"/>
|
||
</span></xsl:otherwise></xsl:choose>
|
||
</xsl:when>
|
||
<!-- author is not in people.en.xml -->
|
||
<xsl:otherwise>
|
||
<xsl:choose>
|
||
<!-- person has a link -->
|
||
<xsl:when test="link">
|
||
<a rel="author" href="{link}"><xsl:value-of select="name"/></a>
|
||
</xsl:when>
|
||
<!-- person has no link -->
|
||
<xsl:otherwise>
|
||
<span class="author p-author"><xsl:value-of select="name"/>
|
||
</span></xsl:otherwise></xsl:choose>
|
||
</xsl:otherwise></xsl:choose>
|
||
<xsl:if test="not(position() = last())">
|
||
<xsl:text>, </xsl:text>
|
||
</xsl:if>
|
||
</xsl:template>
|
||
|
||
|
||
<!-- ==================================================================== -->
|
||
<!-- Display a single news item -->
|
||
<!-- ==================================================================== -->
|
||
|
||
<xsl:template match="news">
|
||
|
||
<!-- Wrap the news item into an <article> -->
|
||
<xsl:element name="article">
|
||
<xsl:attribute name="class">news with-image-left</xsl:attribute>
|
||
<xsl:attribute name="id">
|
||
<xsl:value-of select="@filename"/>
|
||
</xsl:attribute>
|
||
|
||
<!-- Image -->
|
||
<xsl:call-template name="news-image">
|
||
<xsl:with-param name="shrink" select="'yes'" />
|
||
</xsl:call-template>
|
||
|
||
<xsl:element name="div">
|
||
<xsl:attribute name="class">news-inner</xsl:attribute>
|
||
<!-- Title with or without link -->
|
||
<xsl:element name="h3">
|
||
<xsl:call-template name="news-title"/>
|
||
</xsl:element>
|
||
|
||
<!-- Date and author -->
|
||
<xsl:element name="p">
|
||
<xsl:attribute name="class">meta</xsl:attribute>
|
||
<xsl:call-template name="news-date"/>
|
||
<xsl:if test="author">
|
||
<xsl:text> – </xsl:text>
|
||
<xsl:apply-templates select="author"/>
|
||
</xsl:if>
|
||
</xsl:element>
|
||
|
||
<!-- Text and "read-more" link -->
|
||
<xsl:call-template name="news-teaser"/>
|
||
|
||
<!-- Tags -->
|
||
<xsl:apply-templates select="tags"/>
|
||
</xsl:element> <!-- /div -->
|
||
|
||
</xsl:element>
|
||
|
||
</xsl:template>
|
||
|
||
|
||
<!-- ==================================================================== -->
|
||
<!-- Display a verbose list of news items -->
|
||
<!-- ==================================================================== -->
|
||
|
||
<xsl:template match="include-news">
|
||
|
||
<!-- Loop through all news items except those in the future -->
|
||
<xsl:for-each select="/buildinfo/document/set/news[
|
||
translate(@date, '-', '') <= translate(/buildinfo/@date, '-', '')
|
||
]">
|
||
<xsl:sort select="@date" order="descending"/>
|
||
|
||
<!-- Before every 5 news, show a banner, depending on even or odd number of position in loop -->
|
||
<xsl:if test="position() mod 5 = 0">
|
||
<xsl:choose>
|
||
<!-- even number -->
|
||
<xsl:when test="position() mod 2 = 0">
|
||
<xsl:apply-templates select="/buildinfo/document/banner1/node()" />
|
||
</xsl:when>
|
||
<!-- odd number -->
|
||
<xsl:otherwise>
|
||
<xsl:apply-templates select="/buildinfo/document/banner2/node()" />
|
||
</xsl:otherwise>
|
||
</xsl:choose>
|
||
</xsl:if>
|
||
|
||
<!-- Display the news items -->
|
||
<xsl:apply-templates select="."/>
|
||
|
||
</xsl:for-each>
|
||
|
||
</xsl:template>
|
||
|
||
</xsl:stylesheet>
|