c3d2-web/xsl/datenspuren/xhtml.xsl

229 lines
8.6 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="xsl date">
<xsl:include href="../common.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:strip-space elements="p ul td"/>
<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:otherwise>
<xsl:comment><xsl:text> missing title </xsl:text></xsl:comment>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<html lang="de" xml:lang="de">
<xsl:call-template name="htmlhead">
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
<body>
<xsl:call-template name="heading">
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
<div id="content">
<xsl:apply-templates/>
</div>
<xsl:call-template name="ending"/>
</body>
</html>
</xsl:template>
<!-- Parse XHTML schedule generated by Pentabarf[tm] -->
<!-- Da ich hier nicht lange frickeln wollte, wird xhtml nochmal als
extra NS behandelt, also jegliche Elemente in XPath mit xhtml:
prefixen
Weiterhin ist Pentabarf-Output XHTML und kein schicker XML-Dialekt.
Dafür haben wir da drin aber schon eine schicke Tabellenstruktur. Für
die <td/>s usw. extra Templates anzulegen war mir zu unsauber, deshalb
wird hier überall manuell durchiteriert.
Vorgehensweise klar? -~~~~ -->
<xsl:template match="/html">
<xsl:variable name="title">Programm</xsl:variable>
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<xsl:call-template name="htmlhead">
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
<body>
<xsl:call-template name="heading">
<xsl:with-param name="title" select="$title"/>
</xsl:call-template>
<div id="bodyText">
<table cellpadding="4" cellspacing="6" class="schedule">
<xsl:for-each select="body/div/div/table">
<tr>
<th align="center" colspan="3" class="scheduledate">
<xsl:choose>
<xsl:when test="position()=1">5. Mai</xsl:when>
<xsl:when test="position()=2">6. Mai</xsl:when>
</xsl:choose>
</th>
</tr>
<tr>
<xsl:for-each select="thead/tr/th">
<th>
<xsl:if test="strong">
<xsl:attribute name="class">schedulehead</xsl:attribute>
<xsl:value-of select="."/>
</xsl:if>
</th>
</xsl:for-each>
</tr>
<xsl:for-each select="tbody/tr">
<tr>
<xsl:for-each select="td">
<xsl:if test="@class">
<td>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="@class='time'">scheduletime</xsl:when>
<xsl:when test="@class='room event '">scheduleevent</xsl:when>
<xsl:otherwise>scheduleempty</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="rowspan">
<xsl:value-of select="@rowspan"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test='count(*)=0'>
<!-- Zeit oder leer -->
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<!-- Event -->
<a>
<xsl:attribute name="class">event</xsl:attribute>
<xsl:attribute name="href"><xsl:value-of select="concat('http://www.datenspuren.de', p[@class='title']/a/@href)"/></xsl:attribute>
<xsl:value-of select="p[@class='title']"/>
</a>
<ul>
<xsl:for-each select="ul[@class='speakers']/li/a">
<li>
<a>
<xsl:attribute name="href"><xsl:value-of select="concat('http://www.datenspuren.de', @href)"/></xsl:attribute>
<xsl:value-of select="."/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:otherwise>
</xsl:choose>
</td>
</xsl:if>
</xsl:for-each>
</tr>
</xsl:for-each>
</xsl:for-each>
</table>
</div>
<xsl:call-template name="ending"/>
</body>
</html>
</xsl:template>
<xsl:template name="htmlhead">
<xsl:param name="title"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Symposium Datenspuren - Privatsphäre war gestern, 07.-08.06.2008, Kulturzentrum Scheune, veranstaltet vom Chaos Computer Club Dresden" />
<meta name="keywords" content="Symposium Datenspuren,c3d2,Chaos Computer Club,CCC,Dresden,Datenschutz,Privatsphäre,Anonymität,informationelle Selbstbestimmung,Überwachung,Data Mining,ETSI,RFID,Mautsystem,Remailer,TCPA,TCG,Bundestrojaner,Vorratsdatenspeicherung,Biometrie" />
<meta name="robots" content="index,follow" />
<meta name="language" content="German" />
<link rel="stylesheet" type="text/css" href="style/style.css" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="news-rss.xml" />
<link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="news-atom.xml" />
<title>
<xsl:text>Datenspuren 2008 - </xsl:text>
<xsl:value-of select="$title" />
</title>
</head>
</xsl:template>
<xsl:template name="heading">
<div id="head">
<p id="c3d2">
Chaos Computer Club Dresden
</p>
<div id="headline">
<h1>Datenspuren 2008</h1>
<p>
Privatsphäre war gestern
</p>
</div>
</div>
<ul class="navigation">
<li><a href="index.html">News</a></li>
<li><a href="info.html">Informationen</a></li>
<li><a href="ort.html">Ort</a></li>
<!--li><a href="programm.html">Programm</a></li-->
<!--li><a href="lounge.html">Lounge</a></li-->
<li><a href="mitschnitte.html">Mitschnitte</a></li>
</ul>
</xsl:template>
<xsl:template name="ending">
<p id="foot">
CC BY, CCCDD 2008
<xsl:text> </xsl:text>
<a href="/2007/">2007</a>
<xsl:text> </xsl:text>
<a href="/2006/">2006</a>
<xsl:text> </xsl:text>
<a href="/2005/">2005</a>
<xsl:text> </xsl:text>
<a href="/2004/">2004</a>
</p>
</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))">
<h3 class="summary">
<a href="https://www.c3d2.de/news/{substring-before(substring-after($newsfile, 'content/'), '.xml')}.html" class="url">
<xsl:value-of select="@title"/>
</a>
</h3>
<xsl:apply-templates/>
</xsl:if>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>