html.xsl raus!
XPath-Klarifikationen Jeder News noch eine eigene HTML-Seite <addendum/> für Newstext, der nicht in der Übersicht stehen soll Weiterlesen-Link in der Newsübersicht (TODO: muss auch in RSS & ATOM!) git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@324 31f61c52-7bfb-0310-b897-fc00f8a278f0ds2013
parent
c38ecd1271
commit
bb29db45ad
7
Makefile
7
Makefile
|
@ -32,11 +32,12 @@ SKEL=empty
|
|||
# Zu verwendendes Skeleton
|
||||
SKELFILE=content/skel-$(SKEL).xml
|
||||
# Dateinamen der Inhalte:
|
||||
CONTENT=$(PAGES) $(DS_PAGES) $(NEWSFILES)
|
||||
CONTENT=$(PAGES) $(NEWS_PAGES) $(DS_PAGES) $(NEWSFILES)
|
||||
# Chaosupdates
|
||||
WWW_CCC_DE_UPDATES=chaosupdates.rdf
|
||||
|
||||
PAGES:=$(patsubst content/%.xml, www/%.html, $(filter-out $(NAVIGATION) $(SKELETONS), $(wildcard content/*.xml)))
|
||||
NEWS_PAGES:=$(patsubst content/news/%.xml, www/news/%.html, $(wildcard content/news/*.xml))
|
||||
DS_PAGES:=$(patsubst content/datenspuren/%.xml, www/datenspuren/%.html, $(wildcard content/datenspuren/*.xml)) www/datenspuren/schedule.html
|
||||
NEWSINDEX:=content/news.xml
|
||||
NEWSITEMS:=$(filter-out $(NEWSINDEX), $(wildcard content/news/*.xml))
|
||||
|
@ -105,6 +106,10 @@ www/%.html: content/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
|
|||
$(VALIDATOR) $(VFLAGS) $<
|
||||
$(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
|
||||
|
||||
#www/news/%.html: content/news/%.xml $(STYLE) $(NAVIGATION) $(WWW_CCC_DE_UPDATES)
|
||||
# $(VALIDATOR) $(VFLAGS) $<
|
||||
# $(PROCESSOR) $(PFLAGS) -o $@ $(STYLE) $<
|
||||
|
||||
### Hilfsregeln zum Editieren ###
|
||||
edit/%:
|
||||
@if [ ! -e content/$(@F).xml ] ; then \
|
||||
|
|
|
@ -6,4 +6,10 @@
|
|||
<p>
|
||||
Der jährlich ausgetragene Chaos Communication Congress beginnt seine Magie auszustreuen. Pflicht!
|
||||
</p>
|
||||
|
||||
<addendum>
|
||||
<p>
|
||||
Unter <link>http://media.ccc.de/filez/congress/2005/lectures/video/mp4/</link> gibts die Mitschnitte.
|
||||
</p>
|
||||
</addendum>
|
||||
</item>
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
encoding="utf-8"
|
||||
indent="yes"/>
|
||||
|
||||
<xsl:variable name="baseurl"/>
|
||||
|
||||
<xsl:template match="news">
|
||||
<xsl:element name="feed">
|
||||
<xsl:attribute name="xmlns">http://www.w3.org/2005/Atom</xsl:attribute>
|
||||
|
|
|
@ -76,11 +76,22 @@
|
|||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="addendum">
|
||||
<!--
|
||||
Wenn wir nicht in news/ oder anderem sind, dann
|
||||
zeige nicht vollen Newstext (<addendum/>)
|
||||
-->
|
||||
<xsl:if test="string-length($baseurl) > 0">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="navitem">
|
||||
<xsl:param name="file"/>
|
||||
<xsl:param name="baseurl"/>
|
||||
<li>
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href"><xsl:value-of select="$file"/>.html</xsl:attribute>
|
||||
<xsl:attribute name="href"><xsl:value-of select="concat($baseurl, $file, '.html')"/></xsl:attribute>
|
||||
<xsl:if test="document(concat('../content/', $file, '.xml'))/page/@pagetitle">
|
||||
<xsl:attribute name="title"><xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@pagetitle"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
|
@ -92,11 +103,12 @@
|
|||
<xsl:template name="navitems">
|
||||
<ul>
|
||||
<li>
|
||||
<a href="news.html" title="News">News</a>
|
||||
<a href="{$baseurl}news.html" title="News">News</a>
|
||||
</li>
|
||||
<xsl:for-each select="document('../content/navigation.xml')/navigation/file">
|
||||
<xsl:call-template name="navitem">
|
||||
<xsl:with-param name="file" select="."/>
|
||||
<xsl:with-param name="baseurl" select="$baseurl"/>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="xsl rss rdf date">
|
||||
|
||||
<xsl:template name="links">
|
||||
<xsl:variable name="baseurl">
|
||||
<xsl:call-template name="getbaseurl" />
|
||||
</xsl:variable>
|
||||
|
||||
<link rel="icon" type="image/png" href="{$baseurl}images/favicon.png" />
|
||||
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="{$baseurl}news-rss.xml" />
|
||||
|
|
149
xsl/html.xsl
149
xsl/html.xsl
|
@ -1,149 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:date="http://exslt.org/dates-and-times"
|
||||
exclude-result-prefixes="xsl date">
|
||||
|
||||
<xsl:import href="xhtml.xsl" />
|
||||
|
||||
<xsl:output method="html"
|
||||
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 name="getbaseurl">
|
||||
<xsl:choose>
|
||||
<xsl:when test="/item">
|
||||
<xsl:text>../../</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>../</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="navitem">
|
||||
<xsl:param name="file"/>
|
||||
|
||||
<xsl:variable name="baseurl">
|
||||
<xsl:if test="/item">
|
||||
<xsl:text>../</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<li>
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href"><xsl:value-of select="concat($baseurl,$file)"/>.xml</xsl:attribute>
|
||||
<xsl:if test="document(concat('../content/', $file, '.xml'))/page/@pagetitle">
|
||||
<xsl:attribute name="title"><xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@pagetitle"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:value-of select="document(concat('../content/', $file, '.xml'))/page/@title"/>
|
||||
</xsl:element>
|
||||
</li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="navitems">
|
||||
<xsl:variable name="baseurl">
|
||||
<xsl:if test="/item">
|
||||
<xsl:text>../</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{$baseurl}news.xml" title="News">News</a>
|
||||
</li>
|
||||
<xsl:for-each select="document('../content/navigation.xml')/navigation/file">
|
||||
<xsl:call-template name="navitem">
|
||||
<xsl:with-param name="file" select="."/>
|
||||
</xsl:call-template>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="news">
|
||||
<xsl:for-each select="document(newsfile, ..)/item">
|
||||
<xsl:sort select="@date" data-type="text" order="descending" />
|
||||
|
||||
<xsl:variable name="current">
|
||||
<xsl:value-of select="." />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="newsfile">
|
||||
<xsl:for-each select="document('../content/news.xml')/page/news/newsfile">
|
||||
<xsl:if test="document(current()) = $current">
|
||||
<xsl:value-of select="current()" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
|
||||
<h3 class="news">
|
||||
<xsl:element name="a">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="$newsfile" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="title">
|
||||
<xsl:value-of select="@title" />
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:value-of select="@title"/>
|
||||
</xsl:element>
|
||||
</h3>
|
||||
|
||||
<small class="news_author">
|
||||
<xsl:value-of select="@author"/>
|
||||
</small>
|
||||
|
||||
<xsl:variable name="datestring">
|
||||
<xsl:value-of select="@date" />
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:element name="small">
|
||||
<xsl:attribute name="class">news_date</xsl:attribute>
|
||||
<xsl:value-of select="concat(' @ ', $datestring)"/>
|
||||
</xsl:element>
|
||||
|
||||
<div class="news">
|
||||
<xsl:choose>
|
||||
|
||||
<!--- <XXX> Kann das hier in ein Template? -->
|
||||
<xsl:when test="image">
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
|
||||
<xsl:attribute name="title"><xsl:value-of select="image/@title"/></xsl:attribute>
|
||||
<xsl:attribute name="alt"><xsl:value-of select="image/@title"/></xsl:attribute>
|
||||
<!-- News-Items haben ihre Bilder abwechselnd rechts und links... -->
|
||||
<xsl:attribute name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="position() mod 2 = 1">
|
||||
<xsl:text>left</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>right</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- TODO:
|
||||
<xsl:call-template name="getimage">
|
||||
<xsl:with-param name="category" select="@category" />
|
||||
</xsl:call-template>
|
||||
-->
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<!-- </XXX> -->
|
||||
|
||||
<xsl:apply-templates/>
|
||||
</div>
|
||||
|
||||
<hr class="news"/>
|
||||
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
126
xsl/xhtml.xsl
126
xsl/xhtml.xsl
|
@ -19,10 +19,11 @@
|
|||
doctype-system="DTD/xhtml1-strict.dtd"
|
||||
indent="yes"/>
|
||||
|
||||
<xsl:template name="getbaseurl">
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="/page">
|
||||
<xsl:variable name="baseurl">
|
||||
<xsl:if test="name(/*)='item'">../</xsl:if>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:template match="/page|/news">
|
||||
<xsl:variable name="title">
|
||||
<xsl:choose>
|
||||
<xsl:when test="/page/@pagetitle">
|
||||
|
@ -141,64 +142,83 @@
|
|||
</xsl:element> <!-- name="html" -->
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="news">
|
||||
<xsl:for-each select="document(newsfile)/item">
|
||||
<xsl:sort select="date:seconds(@date)" data-type="number" order="descending" />
|
||||
<xsl:template match="/page/news">
|
||||
<xsl:for-each select="newsfile">
|
||||
<xsl:variable name="newsfile"><xsl:value-of select="."/></xsl:variable>
|
||||
|
||||
<h3 class="news"><xsl:value-of select="@title"/></h3>
|
||||
<xsl:for-each select="document(concat('../content/', $newsfile))/item">
|
||||
<xsl:sort select="date:seconds(@date)" data-type="number" order="descending" />
|
||||
|
||||
<small class="news_author">
|
||||
<xsl:value-of select="@author"/>
|
||||
</small>
|
||||
<h3 class="news">
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="substring-before($newsfile, '.xml')"/>.html
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@title"/>
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
<xsl:variable name="datestring">
|
||||
<xsl:call-template name="get-datestring">
|
||||
<xsl:with-param name="date" select="@date" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
<small class="news_author">
|
||||
<xsl:value-of select="@author"/>
|
||||
</small>
|
||||
|
||||
<xsl:element name="small">
|
||||
<xsl:attribute name="class">news_date</xsl:attribute>
|
||||
<xsl:value-of select="concat(' @ ', $datestring)"/>
|
||||
</xsl:element>
|
||||
<xsl:variable name="datestring">
|
||||
<xsl:call-template name="get-datestring">
|
||||
<xsl:with-param name="date" select="@date" />
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<div class="news">
|
||||
<xsl:choose>
|
||||
<xsl:element name="small">
|
||||
<xsl:attribute name="class">news_date</xsl:attribute>
|
||||
<xsl:value-of select="concat(' @ ', $datestring)"/>
|
||||
</xsl:element>
|
||||
|
||||
<!--- <XXX> Kann das hier in ein Template? -->
|
||||
<xsl:when test="image">
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
|
||||
<xsl:attribute name="title"><xsl:value-of select="image/@title"/></xsl:attribute>
|
||||
<xsl:attribute name="alt"><xsl:value-of select="image/@title"/></xsl:attribute>
|
||||
<!-- News-Items haben ihre Bilder abwechselnd rechts und links... -->
|
||||
<xsl:attribute name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="position() mod 2 = 1">
|
||||
<xsl:text>left</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>right</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- TODO:
|
||||
<xsl:call-template name="getimage">
|
||||
<xsl:with-param name="category" select="@category" />
|
||||
</xsl:call-template>
|
||||
-->
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<!-- </XXX> -->
|
||||
<div class="news">
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:apply-templates/>
|
||||
</div>
|
||||
<!--- <XXX> Kann das hier in ein Template? -->
|
||||
<xsl:when test="image">
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src"><xsl:value-of select="image"/></xsl:attribute>
|
||||
<xsl:attribute name="title"><xsl:value-of select="image/@title"/></xsl:attribute>
|
||||
<xsl:attribute name="alt"><xsl:value-of select="image/@title"/></xsl:attribute>
|
||||
<!-- News-Items haben ihre Bilder abwechselnd rechts und links... -->
|
||||
<xsl:attribute name="class">
|
||||
<xsl:choose>
|
||||
<xsl:when test="position() mod 2 = 1">
|
||||
<xsl:text>left</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>right</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
</xsl:element>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- TODO:
|
||||
<xsl:call-template name="getimage">
|
||||
<xsl:with-param name="category" select="@category" />
|
||||
</xsl:call-template>
|
||||
-->
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<!-- </XXX> -->
|
||||
|
||||
<hr class="news"/>
|
||||
<xsl:apply-templates/>
|
||||
|
||||
<xsl:if test="//addendum">
|
||||
<p>
|
||||
<a href="{baseurl}{substring-before($newsfile, '.xml')}.html">
|
||||
Weiterlesen...
|
||||
</a>
|
||||
</p>
|
||||
</xsl:if>
|
||||
</div>
|
||||
|
||||
<hr class="news"/>
|
||||
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
|
Loading…
Reference in New Issue