2013-10-29 02:42:40 +01:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<xsl:stylesheet version="1.0"
|
|
|
|
xmlns:atom="http://www.w3.org/2005/Atom"
|
2014-04-01 23:01:28 +02:00
|
|
|
xmlns:date="http://exslt.org/dates-and-times"
|
2013-10-29 02:42:40 +01:00
|
|
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
|
|
|
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
|
|
|
|
|
2013-10-30 00:13:58 +01:00
|
|
|
<xsl:template match="/">
|
|
|
|
<page>
|
|
|
|
<xsl:apply-templates/>
|
|
|
|
</page>
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-10-29 02:42:40 +01:00
|
|
|
<xsl:template match="/config">
|
|
|
|
<portal>
|
2013-11-12 00:16:21 +01:00
|
|
|
<!-- Extract from fetched XML files -->
|
2013-10-29 02:42:40 +01:00
|
|
|
<xsl:apply-templates select="*[@id]"/>
|
2013-11-12 00:16:21 +01:00
|
|
|
|
|
|
|
<!-- Extract from news -->
|
2013-10-29 02:42:40 +01:00
|
|
|
<xsl:for-each select="document('../news.xml')//newsfile">
|
2014-04-02 00:46:58 +02:00
|
|
|
<xsl:variable name="news" select="document(concat('../', .))"/>
|
2014-04-04 21:16:54 +02:00
|
|
|
<xsl:if test="starts-with(date:difference(date:date-time(), concat($news/item/@date, '+02:00')), '-')">
|
2014-04-02 00:46:58 +02:00
|
|
|
<xsl:apply-templates select="$news/item"
|
2014-04-01 23:01:28 +02:00
|
|
|
mode="news">
|
|
|
|
<xsl:with-param name="link"
|
|
|
|
select="concat(substring-before(substring-after(., 'content/'), '.xml'), '.html')"/>
|
|
|
|
</xsl:apply-templates>
|
|
|
|
</xsl:if>
|
2013-10-29 02:42:40 +01:00
|
|
|
</xsl:for-each>
|
|
|
|
</portal>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="/config/gallery">
|
|
|
|
<xsl:apply-templates select="document(concat('../portal/portal-', @id, '.xml'))/atom:feed/atom:entry" mode="gallery"/>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="/config/wiki">
|
2013-11-13 22:43:54 +01:00
|
|
|
<xsl:apply-templates select="document(concat('../portal/portal-', @id, '.xml'))/api/query/recentchanges" mode="wiki"/>
|
2013-10-29 02:42:40 +01:00
|
|
|
</xsl:template>
|
|
|
|
|
2016-04-28 22:50:44 +02:00
|
|
|
<xsl:template match="/config/issues">
|
|
|
|
</xsl:template>
|
|
|
|
|
2013-10-29 02:42:40 +01:00
|
|
|
<xsl:template match="*">
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="atom:entry" mode="gallery">
|
2013-10-30 00:56:06 +01:00
|
|
|
<item date="{atom:updated[1]}">
|
|
|
|
<xsl:apply-templates select="atom:title[1]" mode="gallery"/>
|
|
|
|
<xsl:apply-templates select="atom:content[@type='html'][1]" mode="gallery"/>
|
2013-10-30 01:23:20 +01:00
|
|
|
<xsl:apply-templates select="atom:link[@rel='alternate'][1]" mode="gallery"/>
|
2013-10-30 00:56:06 +01:00
|
|
|
<xsl:apply-templates select="atom:link[@rel='enclosure'][1]" mode="gallery"/>
|
2013-10-29 02:42:40 +01:00
|
|
|
</item>
|
|
|
|
</xsl:template>
|
2013-10-30 00:56:06 +01:00
|
|
|
<xsl:template match="atom:title" mode="gallery">
|
|
|
|
<header><xsl:value-of select="."/></header>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="atom:content[@type='html']" mode="gallery">
|
|
|
|
<footer><xsl:value-of select="." disable-output-escaping="yes"/></footer>
|
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="atom:link[@rel='enclosure' and @href]" mode="gallery">
|
2013-10-30 23:18:30 +01:00
|
|
|
<content-image>
|
2016-10-15 02:11:17 +02:00
|
|
|
<xsl:text>/mgoblin_media/</xsl:text>
|
|
|
|
<xsl:value-of select="substring-after(@href, '/mgoblin_media/')"/>
|
2013-10-30 23:18:30 +01:00
|
|
|
</content-image>
|
2013-10-30 00:56:06 +01:00
|
|
|
</xsl:template>
|
|
|
|
<xsl:template match="atom:link[@rel='alternate' and @href]" mode="gallery">
|
|
|
|
<link><xsl:value-of select="@href"/></link>
|
|
|
|
</xsl:template>
|
2013-10-29 02:42:40 +01:00
|
|
|
|
2013-11-13 22:43:54 +01:00
|
|
|
<xsl:template match="rc" mode="wiki">
|
|
|
|
<xsl:variable name="title" select="@title"/>
|
2013-11-12 23:49:29 +01:00
|
|
|
<!-- Don't repeat any titles -->
|
2013-11-13 22:43:54 +01:00
|
|
|
<xsl:if test="not(preceding-sibling::rc/@title = $title or
|
2014-06-29 17:28:00 +02:00
|
|
|
starts-with($title, 'Intern:') or
|
|
|
|
($title = 'Kühlschrank/Aushang')
|
|
|
|
)">
|
2013-11-13 22:43:54 +01:00
|
|
|
<item date="{@timestamp}" class="wiki">
|
2013-11-12 23:49:29 +01:00
|
|
|
<header>C3D2 Wiki</header>
|
|
|
|
<footer>
|
|
|
|
<xsl:text>by </xsl:text>
|
2013-11-13 22:43:54 +01:00
|
|
|
<xsl:value-of select="@user"/>
|
|
|
|
<xsl:for-each select="following-sibling::rc[@title = $title]">
|
|
|
|
<xsl:variable name="user" select="@user"/>
|
|
|
|
<xsl:if test="not(preceding-sibling::rc[@title = $title and @user = $user])">
|
|
|
|
<xsl:text>, </xsl:text>
|
|
|
|
<xsl:value-of select="normalize-space(@user)"/>
|
|
|
|
</xsl:if>
|
2013-11-12 23:49:29 +01:00
|
|
|
</xsl:for-each>
|
|
|
|
</footer>
|
2013-11-13 22:43:54 +01:00
|
|
|
<content-text><xsl:value-of select="@title"/></content-text>
|
|
|
|
<link>https://wiki.c3d2.de/<xsl:value-of select="@title"/></link>
|
2013-11-12 23:49:29 +01:00
|
|
|
</item>
|
|
|
|
</xsl:if>
|
2013-10-29 02:42:40 +01:00
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
<xsl:template match="item" mode="news">
|
2014-04-01 23:01:28 +02:00
|
|
|
<xsl:param name="link"/>
|
2013-10-29 02:42:40 +01:00
|
|
|
|
2014-04-01 23:01:28 +02:00
|
|
|
<item date="{@date}" class="news">
|
|
|
|
<header>News</header>
|
|
|
|
<footer>by <xsl:value-of select="@author"/></footer>
|
|
|
|
<content-text><xsl:value-of select="@title"/></content-text>
|
|
|
|
<xsl:apply-templates select=".//image[1]" mode="news"/>
|
|
|
|
<link><xsl:value-of select="$link"/></link>
|
|
|
|
</item>
|
2013-10-29 02:42:40 +01:00
|
|
|
</xsl:template>
|
|
|
|
|
2014-02-09 03:49:20 +01:00
|
|
|
<xsl:template match="item/image[1]" mode="news">
|
2013-10-30 00:37:16 +01:00
|
|
|
<content-image>
|
2014-02-09 03:49:20 +01:00
|
|
|
<xsl:text>images/news/</xsl:text>
|
2013-10-30 00:37:16 +01:00
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</content-image>
|
|
|
|
</xsl:template>
|
2014-02-09 03:49:20 +01:00
|
|
|
<xsl:template match="image[contains(., '//')]" mode="news">
|
2013-10-30 00:37:16 +01:00
|
|
|
<content-image>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</content-image>
|
|
|
|
</xsl:template>
|
2013-10-29 02:42:40 +01:00
|
|
|
<xsl:template match="image" mode="news">
|
|
|
|
<content-image>
|
|
|
|
<xsl:value-of select="."/>
|
|
|
|
</content-image>
|
|
|
|
</xsl:template>
|
|
|
|
|
|
|
|
</xsl:stylesheet>
|