150 lines
4.5 KiB
XML
150 lines
4.5 KiB
XML
<?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>
|