c3d2-web/transformation/page2html/include/portal.xsl

72 lines
2.3 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"
xmlns:str="http://exslt.org/strings"
exclude-result-prefixes="xsl rss rdf date str">
<!-- Chaosupdates in tile -->
<xsl:template name="chaosupdates">
<xsl:param name="limit" select="5"/>
<h3>
<a href="{document('../chaosupdates.xml')/rdf:RDF/rss:channel/rss:link}">
<xsl:value-of select="document('../chaosupdates.xml')/rdf:RDF/rss:channel/rss:title"/>
</a>
</h3>
<ul>
<xsl:for-each select="document('../chaosupdates.xml')/rdf:RDF/rss:item[position() &lt;= $limit]">
<li>
<a href="{rss:link}">
<xsl:value-of select="rss:title"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:template>
<!-- Calendar in tile -->
<xsl:template name="calendar-events">
<xsl:param name="limit" select="5"/>
<ul>
<xsl:for-each select="document('../calendar-summary.xml')/page/calendar-summary/event[date:seconds(end) &gt;= date:seconds(date:date())]">
<xsl:sort select="date:seconds(start)" data-type="number" order="ascending" />
<xsl:if test="position() &lt;= $limit">
<xsl:variable name="href">
<xsl:call-template name="make-href">
<xsl:with-param name="href" select="link"/>
</xsl:call-template>
</xsl:variable>
<li>
<xsl:call-template name="datespan-to-human">
<xsl:with-param name="start" select="start"/>
<xsl:with-param name="end" select="end"/>
</xsl:call-template>:
<a>
<xsl:if test="string-length($href) &gt; 0">
<xsl:attribute name="href">
<xsl:value-of select="$href"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="string-length(location) &gt; 0">
<xsl:attribute name="title">
<xsl:value-of select="concat('Ort: ', location)"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="title"/>
</a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>