c3d2-web/xsl/xhtml.xsl

483 lines
16 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:date="http://exslt.org/dates-and-times"
exclude-result-prefixes="xsl">
<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>
<!-- AKVS head start v1.4 -->
<style type="text/css">
<xsl:comment>
div#akct {
position: fixed; top:0px; right: 0px; z-index: 2342; width:113px; height:88px;
background-image: url(http://wiki.vorratsdatenspeicherung.de/images/Akvse.gif);
background-repeat: no-repeat;
background-position: right top;
border:none;
padding:0;
margin:0;
text-align: right;
opacity: 0.85;
}
div#akct img {
border:none;
padding:0;
margin:0;
background: none;
}
div#akct a#akpeel img {
width: 100%;
height: 100%;
}
div#akct a, div#akct a:hover {
text-decoration: none;
border:none;
padding:0;
margin:0;
display: block;
background: none;
}
div#akct a#akpeel:hover {
position: fixed; top:0px; right: 0px; z-index: 4223; width:500px; height:500px;
display: block;
background-image: url(http://wiki.vorratsdatenspeicherung.de/images/Akvsb.gif);
background-repeat: no-repeat;
background-position: right top;
opacity: 1.0;
}
div#akct a#akpreload
{
background-image: url(http://wiki.vorratsdatenspeicherung.de/images/Akvsb.gif);
background-repeat: no-repeat;
background-position: 234px 0px;
}
</xsl:comment>
</style>
<xsl:comment>[if gte IE 5.5]&gt;
&lt;![if lt IE 7]&gt;
&lt;style type="text/css"&gt;
div#akct a#akpeel:hover {
right: -1px;
}
&lt;/style&gt;
&lt;![endif]&gt;
&lt;![endif]</xsl:comment>
<!-- AKVS head end -->
</xsl:element>
<xsl:element name="body">
<!-- AKVS body start v1.4 -->
<div id="akct"><a id="akpeel" href="http://www.vorratsdatenspeicherung.de" title="Stoppt die Vorratsdatenspeicherung! Jetzt klicken &amp; handeln!"><img src="http://wiki.vorratsdatenspeicherung.de/images/Akvst.gif" alt="Stoppt die Vorratsdatenspeicherung! Jetzt klicken &amp; handeln!" /></a></div>
<!-- AKVS body end -->
<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="calendar-events" />
<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">
<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
im <a href="{$baseurl}ical.ics">iCal-</a>, <a href="{$baseurl}xcal.xml">XCal-</a>
und <a href="{$baseurl}reminders">remind-Format</a> abrufbar.
Mehr News gibts im <a href="{$baseurl}news-archiv.html">Archiv</a>.
</p>
<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>
</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:apply-templates select="resource" mode="resources-in-news"/>
</ul>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="resource[not(@hide='yes')]">
<ul>
<xsl:apply-templates select="resource[not(@hide='yes')]" mode="resources-in-news"/>
</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))) and (($details != 'resources-only') or (count(resource) &gt; 0))">
<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 = 'resources-only'">
<xsl:call-template name="include-resources">
<xsl:with-param name="include-hidden">yes</xsl:with-param>
</xsl:call-template>
</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:template match="resource" mode="resources-in-news">
<xsl:call-template name="resource-item"/>
<xsl:apply-templates select="alternative" mode="resources-in-news"/>
</xsl:template>
<xsl:template match="resource/alternative" mode="resources-in-news">
<xsl:call-template name="resource-item">
<xsl:with-param name="title" select="../@title"/>
</xsl:call-template>
</xsl:template>
<xsl:template name="resource-item">
<xsl:param name="title" select="@title"/>
<xsl:variable name="href">
<xsl:call-template name="make-href">
<xsl:with-param name="href" select="@url"/>
</xsl:call-template>
</xsl:variable>
<li>
<!-- MIME-Type ist nützlich z.B. für ftp:// URLs -->
<a href="{$href}" type="{@type}" class="mime" rel="enclosure">
<xsl:choose>
<xsl:when test="string-length(string($title))"><xsl:value-of select="$title"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$href"/></xsl:otherwise>
</xsl:choose>
</a>
(<xsl:call-template name="mime-for-human">
<xsl:with-param name="mime" select="@type"/>
</xsl:call-template>, <xsl:call-template name="format-filesize">
<xsl:with-param name="value" select="@size"/>
</xsl:call-template>)
<xsl:if test="@type='audio/mpeg'">
<br/>
<object type="application/x-shockwave-flash"
data="{$baseurl}script/dewplayer-mini.swf?mp3={$href}&amp;showtime=1"
width="150" height="20">
<param name="wmode" value="transparent"/>
<param name="allowScriptAccess" value="always"/>
<param name="movie"
value="{$baseurl}script/dewplayer-mini.swf?mp3={$href}&amp;showtime=1"/>
</object>
</xsl:if>
</li>
</xsl:template>
</xsl:stylesheet>