c3d2-web/xsl/xhtml.xsl

375 lines
12 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rss="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="xsl rss rdf">
<xsl:include href="common.xsl" />
<xsl:include href="header.xsl" />
<xsl:include href="footer.xsl" />
<xsl:include href="calendar.xsl" />
<xsl:output method="xml"
version="1.0"
encoding="utf-8"
doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="DTD/xhtml1-strict.dtd"
indent="yes"/>
<xsl:template match="/page">
<xsl:variable name="title">
<xsl:choose>
<xsl:when test="/page/@pagetitle">
<xsl:value-of select="/page/@pagetitle"/>
</xsl:when>
<xsl:when test="/page/@title">
<xsl:value-of select="/page/@title"/>
</xsl:when>
<xsl:when test="/page/calendar-summary">
<xsl:call-template name="calendar-title"/>
</xsl:when>
<xsl:otherwise>
<xsl:comment><xsl:text> missing title </xsl:text></xsl:comment>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="body">
<xsl:with-param name="title" select="$title" />
</xsl:call-template>
</xsl:template>
<xsl:template match="/item">
<xsl:variable name="title">
<xsl:value-of select="/item/@title"/>
</xsl:variable>
<xsl:call-template name="body">
<xsl:with-param name="title" select="$title" />
</xsl:call-template>
</xsl:template>
<xsl:template name="body">
<xsl:param name="title" />
<xsl:variable name="issearchpage" select="$title = 'Suche'" />
<xsl:element name="html">
<xsl:attribute name="lang">de</xsl:attribute>
<xsl:attribute name="xml:lang">de</xsl:attribute>
<xsl:element name="head">
<xsl:call-template name="header" />
<title>
<xsl:text>&lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden | c3d2 - </xsl:text>
<xsl:value-of select="$title" />
</title>
</xsl:element>
<xsl:element name="body">
<div id="page">
<!-- ### Logo ### -->
<xsl:comment>
<xsl:text> ### Logo ### </xsl:text>
</xsl:comment>
<div id="logo">
<h1>&lt;&lt;&lt;/&gt;&gt; Chaos Computer Club Dresden | c3d2</h1>
</div>
<div id="body">
<!-- ### Navigation ### -->
<xsl:comment>
<xsl:text> ### Navigation ### </xsl:text>
</xsl:comment>
<div id="navigation">
<xsl:if test="not($issearchpage)">
<!-- ### Search ### -->
<xsl:comment>
<xsl:text> ### Search ### </xsl:text>
</xsl:comment>
<form action="/cgi-bin/estseek.cgi" method="get">
<p>
<input type="text" name="phrase" size="20" value="c3d2" />
<input type="submit" name="submit" value="Suchen!" />
<a href="{$baseurl}cgi-bin/estseek.cgi"><small>Hilfe</small></a>
</p>
</form>
</xsl:if>
<xsl:call-template name="navitems" />
</div> <!-- id="navigation" -->
<!-- ### Content ### -->
<xsl:comment>
<xsl:text> ### Content ### </xsl:text>
</xsl:comment>
<xsl:choose>
<xsl:when test="$issearchpage">
<div id="content" class="search">
<h2>Suche</h2>
<xsl:comment>ESTFORM</xsl:comment>
<xsl:comment>ESTRESULT</xsl:comment>
<xsl:comment>ESTINFO</xsl:comment>
</div> <!-- id="search" -->
</xsl:when>
<xsl:otherwise> <!-- normale Seite -->
<div id="content">
<xsl:if test="event">
<xsl:attribute name="class">vevent</xsl:attribute>
</xsl:if>
<h2>
<xsl:if test="name(.) = 'item'">
<xsl:attribute name="class">news</xsl:attribute>
</xsl:if>
<xsl:value-of select="$title" />
</h2>
<!-- Für Seiten, die nur ein Newsitem beinhalten,
Newsmetadaten anzeigen
-->
<xsl:if test="name(.) = 'item'">
<xsl:call-template name="news-meta"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:call-template name="include-resources">
<xsl:with-param name="include-hidden">yes</xsl:with-param>
</xsl:call-template>
</div> <!-- id="content" -->
<!-- ### News ### -->
<xsl:comment>
<xsl:text> ### News ### </xsl:text>
</xsl:comment>
<xsl:call-template name="chaosupdates" />
</xsl:otherwise>
</xsl:choose>
</div> <!-- id="body" -->
<!-- ### Footer ### -->
<xsl:comment>
<xsl:text> ### Footer ### </xsl:text>
</xsl:comment>
<div id="footer">
<xsl:call-template name="footer" />
<!-- <p id="update">
<strong>last update:</strong> 02/08/2005 15:15 CEST
</p> -->
</div> <!-- id="footer" -->
<small class="hidden">
Cover, Concealment, Camouflage, Denial and Deception
</small>
</div> <!-- id="page" -->
</xsl:element> <!-- name="body" -->
</xsl:element> <!-- name="html" -->
</xsl:template>
<xsl:template match="/page/news">
<xsl:for-each select="newsfile">
<xsl:sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
<xsl:if test="position() &lt;= 10">
<xsl:variable name="newsfile"><xsl:value-of select="."/></xsl:variable>
<xsl:variable name="itemposition" select="position()"/>
<xsl:for-each select="document(concat('../', $newsfile))/item">
<div>
<xsl:if test="event">
<xsl:attribute name="class">vevent</xsl:attribute>
</xsl:if>
<h3 class="news summary">
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html" class="url">
<xsl:value-of select="@title"/>
</a>
</h3>
<xsl:call-template name="news-meta"/>
<div class="news">
<xsl:apply-templates>
<xsl:with-param name="itemposition" select="$itemposition"/>
</xsl:apply-templates>
<xsl:call-template name="include-resources">
<xsl:with-param name="include-hidden">no</xsl:with-param>
</xsl:call-template>
<xsl:if test="//addendum">
<p>
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html">
Weiterlesen...
</a>
</p>
</xsl:if>
</div>
<hr class="news"/>
</div>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
<p>
Die Neuigkeiten des C3D2 sind auch als <a href="{$baseurl}news-atom.xml">ATOM</a> und <a href="{$baseurl}news-rss.xml">RSS</a>, die Veranstaltungen als <a href="{$baseurl}ical.ics">iCal</a> und <a href="{$baseurl}xcal.xml">XCal</a> abrufbar.
Mehr News gibts im <a href="{$baseurl}news-archiv.html">Archiv</a>.
</p>
</xsl:template>
<xsl:template name="news-meta">
<small class="news_author">
<xsl:value-of select="@author"/>
</small>
<small class="news_date">
@
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="@date" />
</xsl:call-template>
</small>
</xsl:template>
<xsl:template name="include-resources">
<xsl:param name="include-hidden"/>
<xsl:choose>
<xsl:when test="$include-hidden='yes'">
<xsl:if test="resource">
<ul>
<xsl:for-each select="resource">
<li>
<a href="{translate(., ' ', '+')}" type="{@type}">
<xsl:choose>
<xsl:when test="@title"><xsl:value-of select="@title"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="resource[not(@hide='yes')]">
<ul>
<xsl:for-each select="resource[not(@hide='yes')]">
<li>
<a href="{translate(., ' ', '+')}" type="{@type}">
<xsl:choose>
<xsl:when test="@title"><xsl:value-of select="@title"/></xsl:when>
<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
</xsl:choose>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="item/image">
<xsl:param name="itemposition"/>
<img>
<xsl:choose>
<xsl:when test="contains(., '://')">
<xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="src"><xsl:value-of select="concat($baseurl, 'images/news/', .)"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="title"><xsl:value-of select="@title"/></xsl:attribute>
<xsl:attribute name="alt"><xsl:value-of select="title"/></xsl:attribute>
<!-- News-Items haben ihre Bilder abwechselnd rechts und links... -->
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$itemposition mod 2 = 1">
<xsl:text>left</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>right</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</img>
</xsl:template>
<xsl:template match="news-list">
<xsl:variable name="prefix" select="@prefix"/>
<xsl:variable name="details" select="@details"/>
<xsl:for-each select="document('../news.xml')/page/news/newsfile">
<xsl:sort select="date:seconds(document(concat('../', .))/item/@date)" data-type="number" order="descending" />
<xsl:variable name="newsfile" select="."/>
<xsl:for-each select="document(concat('../', $newsfile))/item">
<xsl:if test="(string-length($prefix) = 0) or starts-with($newsfile, concat('content/news/', $prefix))">
<div>
<xsl:if test="($details = 'event') and event">
<xsl:attribute name="class">vevent</xsl:attribute>
</xsl:if>
<h3 class="summary">
<a href="{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html" class="url">
<xsl:value-of select="@title"/>
</a>
</h3>
<xsl:choose>
<xsl:when test="$details = 'news'">
<xsl:call-template name="news-meta"/>
</xsl:when>
<xsl:when test="($details = 'event') and event">
<ul class="details_event">
<li>
<abbr class="dtstart">
<xsl:attribute name="title">
<xsl:call-template name="date-to-hevent">
<xsl:with-param name="date" select="event/start"/>
</xsl:call-template>
</xsl:attribute>
<xsl:call-template name="get-datestring">
<xsl:with-param name="date" select="event/start"/>
</xsl:call-template>
</abbr>
</li>
<li class="location">
<xsl:value-of select="event/location"/>
</li>
</ul>
</xsl:when>
</xsl:choose>
</div>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>