Modularisierung des ATOM-XSL
mode="escaped" für RSS-XSL Links zu Newsseiten in den Feeds git-svn-id: svn://svn.c3d2.de/c3d2-web/trunk@325 31f61c52-7bfb-0310-b897-fc00f8a278f0
This commit is contained in:
parent
bb29db45ad
commit
b907457c75
45
xsl/atom.xsl
45
xsl/atom.xsl
|
@ -3,7 +3,7 @@
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:date="http://exslt.org/dates-and-times"
|
xmlns:date="http://exslt.org/dates-and-times"
|
||||||
xmlns:crypto="http://exslt.org/crypto"
|
xmlns:crypto="http://exslt.org/crypto"
|
||||||
exclude-result-prefixes="xsl">
|
exclude-result-prefixes="xsl crypto date">
|
||||||
|
|
||||||
<xsl:include href="common.xsl" />
|
<xsl:include href="common.xsl" />
|
||||||
|
|
||||||
|
@ -28,25 +28,34 @@
|
||||||
<pubDate><xsl:value-of select="news/item/@date"/></pubDate>
|
<pubDate><xsl:value-of select="news/item/@date"/></pubDate>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<xsl:for-each select="document(newsfile)/item">
|
<xsl:for-each select="newsfile">
|
||||||
<xsl:sort select="date:seconds(@date)" data-type="number" order="descending" />
|
<xsl:sort select="date:seconds(document(.)/@date)" data-type="number" order="descending" />
|
||||||
|
<xsl:variable name="newsfile" select="."/>
|
||||||
<entry>
|
|
||||||
<id><xsl:value-of select="crypto:sha1(concat(@title,@date))"/></id>
|
<xsl:for-each select="document(.)/item">
|
||||||
<title><xsl:value-of select="@title"/></title>
|
<xsl:call-template name="atom-entry">
|
||||||
<updated><xsl:value-of select="@date"/></updated>
|
<xsl:with-param name="newsfile" select="$newsfile"/>
|
||||||
<author>
|
</xsl:call-template>
|
||||||
<name><xsl:value-of select="@author"/></name>
|
</xsl:for-each>
|
||||||
</author>
|
|
||||||
<content type="xhtml">
|
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<xsl:apply-templates/>
|
|
||||||
</div>
|
|
||||||
</content>
|
|
||||||
</entry>
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
</xsl:element>
|
</xsl:element>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="atom-entry">
|
||||||
|
<xsl:param name="newsfile"/>
|
||||||
|
<entry>
|
||||||
|
<id><xsl:value-of select="crypto:sha1(concat(@title,@date))"/></id>
|
||||||
|
<title><xsl:value-of select="@title"/></title>
|
||||||
|
<link href="https://www.c3d2.de/{substring-before($newsfile, '.xml')}.html"/>
|
||||||
|
<updated><xsl:value-of select="@date"/></updated>
|
||||||
|
<author>
|
||||||
|
<name><xsl:value-of select="@author"/></name>
|
||||||
|
</author>
|
||||||
|
<content type="xhtml">
|
||||||
|
<div xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<xsl:apply-templates/>
|
||||||
|
</div>
|
||||||
|
</content>
|
||||||
|
</entry>
|
||||||
|
</xsl:template>
|
||||||
</xsl:stylesheet>
|
</xsl:stylesheet>
|
||||||
|
|
23
xsl/rss.xsl
23
xsl/rss.xsl
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xsl:stylesheet version="1.0"
|
<xsl:stylesheet version="1.0"
|
||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
exclude-result-prefixes="xsl">
|
xmlns:date="http://exslt.org/dates-and-times"
|
||||||
|
exclude-result-prefixes="xsl date">
|
||||||
|
|
||||||
<xsl:output method="xml"
|
<xsl:output method="xml"
|
||||||
version="1.0"
|
version="1.0"
|
||||||
|
@ -18,9 +19,13 @@
|
||||||
<link>https://www.c3d2.de/</link>
|
<link>https://www.c3d2.de/</link>
|
||||||
<description>Neues aus dem Chaos Computer Club Dresden</description>
|
<description>Neues aus dem Chaos Computer Club Dresden</description>
|
||||||
<language>de-de</language>
|
<language>de-de</language>
|
||||||
<pubDate><xsl:value-of select="news/item/@date"/></pubDate>
|
<!-- TODO: Insert "now": <pubDate><xsl:value-of select="news/item/@date"/></pubDate> -->
|
||||||
<xsl:for-each select="newsfile">
|
<xsl:for-each select="newsfile">
|
||||||
<xsl:apply-templates select="document(current())/item" />
|
<xsl:sort select="date:seconds(document(.)/item/@date)" data-type="number" order="descending" />
|
||||||
|
|
||||||
|
<xsl:apply-templates select="document(.)/item">
|
||||||
|
<xsl:with-param name="newsfile" select="."/>
|
||||||
|
</xsl:apply-templates>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</channel>
|
</channel>
|
||||||
|
|
||||||
|
@ -28,28 +33,30 @@
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="item">
|
<xsl:template match="item">
|
||||||
|
<xsl:param name="newsfile"/>
|
||||||
<item>
|
<item>
|
||||||
<title><xsl:value-of select="@title"/></title>
|
<title><xsl:value-of select="@title"/></title>
|
||||||
<description><xsl:apply-templates/></description>
|
<link>https://www.c3d2.de/<xsl:value-of select="substring-before($newsfile, '.xml')"/>.html</link>
|
||||||
|
<description><xsl:apply-templates mode="escaped"/></description>
|
||||||
<author><xsl:value-of select="@author"/></author>
|
<author><xsl:value-of select="@author"/></author>
|
||||||
<category><xsl:value-of select="@category"/></category>
|
<category><xsl:value-of select="@category"/></category>
|
||||||
<pubDate><xsl:value-of select="@date"/></pubDate>
|
<pubDate><xsl:value-of select="@date"/></pubDate>
|
||||||
</item>
|
</item>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="pre">
|
<xsl:template match="pre" mode="escaped">
|
||||||
<pre><xsl:apply-templates/></pre>
|
<pre><xsl:apply-templates/></pre>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="p">
|
<xsl:template match="p" mode="escaped">
|
||||||
<p><xsl:apply-templates/></p>
|
<p><xsl:apply-templates/></p>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="image">
|
<xsl:template match="image" mode="escaped">
|
||||||
<img src="<xsl:value-of select="."/>"<xsl:if test="@title"> title="<xsl:value-of select="@title"/>" alt="<xsl:value-of select="@title"/>"</xsl:if><xsl:if test="@class"> class="<xsl:value-of select="@class"/>"</xsl:if>/>
|
<img src="<xsl:value-of select="."/>"<xsl:if test="@title"> title="<xsl:value-of select="@title"/>" alt="<xsl:value-of select="@title"/>"</xsl:if><xsl:if test="@class"> class="<xsl:value-of select="@class"/>"</xsl:if>/>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="link">
|
<xsl:template match="link" mode="escaped">
|
||||||
<a<xsl:choose>
|
<a<xsl:choose>
|
||||||
<xsl:when test="@href">
|
<xsl:when test="@href">
|
||||||
href="<xsl:value-of select="@href"/>"
|
href="<xsl:value-of select="@href"/>"
|
||||||
|
|
Loading…
Reference in New Issue