Add some fixes for RSS stylesheets
parent
6948a0e421
commit
aa7f834353
|
@ -43,7 +43,7 @@
|
|||
<xsl:value-of select="normalize-space(.)" />
|
||||
</xsl:variable>
|
||||
|
||||
<!-- Add leading "http://fsfe.org" if necessary -->
|
||||
<!-- Add leading "https://fsfe.org" if necessary -->
|
||||
<xsl:variable name="full-link">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with ($link, 'http:')">
|
||||
|
@ -52,14 +52,14 @@
|
|||
<xsl:when test="starts-with ($link, 'https:')">
|
||||
<xsl:value-of select="$link" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>http://fsfe.org<xsl:value-of select="$link" />
|
||||
<xsl:otherwise>https://fsfe.org<xsl:value-of select="$link" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- Insert language into link -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with ($full-link, 'http://www.fsfeurope.org/')
|
||||
<xsl:when test="starts-with ($full-link, 'https://fsfe.org/')
|
||||
and substring-before ($full-link, '.html') != ''">
|
||||
<xsl:value-of select="concat (substring-before ($full-link, '.html'),
|
||||
'.', $lang, '.html')" />
|
||||
|
@ -89,7 +89,7 @@
|
|||
<channel>
|
||||
<title>FSFE News</title>
|
||||
<description>News from the Free Software Foundation Europe</description>
|
||||
<link>http://fsfe.org/news/</link>
|
||||
<link>https://fsfe.org/news/</link>
|
||||
<language><xsl:value-of select="$lang" /></language>
|
||||
<copyright>Copyright (c) Free Software Foundation Europe. Verbatim copying and distribution
|
||||
of this entire article is permitted in any medium, provided this
|
||||
|
@ -97,15 +97,15 @@
|
|||
<managingEditor>press@fsfe.org (FSFE Press Team)</managingEditor>
|
||||
<webMaster>web@lists.fsfe.org (FSFE Webmaster Team)</webMaster>
|
||||
<image>
|
||||
<url>http://fsfe.org/news/fsfe-news.png</url>
|
||||
<url>https://fsfe.org/news/fsfe-news.png</url>
|
||||
<title>FSFE News</title>
|
||||
<width>88</width>
|
||||
<height>31</height>
|
||||
<link>http://fsfe.org/news/</link>
|
||||
<link>https://fsfe.org/news/</link>
|
||||
</image>
|
||||
|
||||
<xsl:element name="atom:link">
|
||||
<xsl:attribute name="href">http://fsfe.org/news/news.<xsl:value-of select="$lang"/>.rss</xsl:attribute>
|
||||
<xsl:attribute name="href">https://fsfe.org/news/news.<xsl:value-of select="$lang"/>.rss</xsl:attribute>
|
||||
<xsl:attribute name="rel">self</xsl:attribute>
|
||||
<xsl:attribute name="type">application/rss+xml</xsl:attribute>
|
||||
</xsl:element>
|
||||
|
@ -196,11 +196,10 @@
|
|||
<!-- take care that links within <content:encoded> are not relative -->
|
||||
<xsl:template match="a">
|
||||
<xsl:element name="a">
|
||||
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="substring(@href,1,1) = '/'">
|
||||
<xsl:text>http://fsfe.org</xsl:text>
|
||||
<xsl:text>https://fsfe.org</xsl:text>
|
||||
<xsl:value-of select="@href" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
@ -208,26 +207,17 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:value-of select="." />
|
||||
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!-- remove newsteaser from <p> -->
|
||||
<xsl:template match="p">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<!-- as well as images -->
|
||||
<xsl:template match="img">
|
||||
<xsl:element name="img">
|
||||
<xsl:attribute name="src">
|
||||
<xsl:choose>
|
||||
<xsl:when test="substring(@src,1,1) = '/'">
|
||||
<xsl:text>http://fsfe.org</xsl:text>
|
||||
<xsl:text>https://fsfe.org</xsl:text>
|
||||
<xsl:value-of select="@src" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
@ -238,6 +228,13 @@
|
|||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Allow basic styling elements, copy them without attributes -->
|
||||
<xsl:template match="p|strong|em|ul|ol|li|h1|h2|h3|h4|h5|h6">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Do not copy <body-complete> to output at all -->
|
||||
<xsl:template match="body-complete"/>
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
<!-- Add leading "https://fsfe.org" if necessary -->
|
||||
<xsl:variable name="full-link">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with ($link, 'https:')">
|
||||
<xsl:when test="starts-with ($link, 'http:')">
|
||||
<xsl:value-of select="$link" />
|
||||
</xsl:when>
|
||||
<xsl:when test="starts-with ($link, 'https:')">
|
||||
|
@ -63,7 +63,7 @@
|
|||
|
||||
<!-- Insert language into link -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with ($full-link, 'http://www.fsfeurope.org/')
|
||||
<xsl:when test="starts-with ($full-link, 'https://fsfe.org/')
|
||||
and substring-before ($full-link, '.html') != ''">
|
||||
<xsl:value-of select="concat (substring-before ($full-link, '.html'),
|
||||
'.', $lang, '.html')" />
|
||||
|
@ -349,7 +349,6 @@
|
|||
<!-- take care that links within <content:encoded> are not relative -->
|
||||
<xsl:template match="a">
|
||||
<xsl:element name="a">
|
||||
|
||||
<xsl:attribute name="href">
|
||||
<xsl:choose>
|
||||
<xsl:when test="substring(@href,1,1) = '/'">
|
||||
|
@ -361,11 +360,10 @@
|
|||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
|
||||
<xsl:value-of select="." />
|
||||
|
||||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!-- as well as images -->
|
||||
<xsl:template match="img">
|
||||
<xsl:element name="img">
|
||||
|
@ -383,14 +381,8 @@
|
|||
</xsl:element>
|
||||
</xsl:template>
|
||||
|
||||
<!-- remove newsteaser from <p> -->
|
||||
<xsl:template match="p">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()" />
|
||||
</xsl:copy>
|
||||
</xsl:template>
|
||||
<!-- Allow other basic styling elements, copy them verbatim -->
|
||||
<xsl:template match="strong|em|ul|ol|li|h1|h2|h3|h4|h5|h6">
|
||||
<!-- Allow basic styling elements, copy them without attributes -->
|
||||
<xsl:template match="p|strong|em|ul|ol|li|h1|h2|h3|h4|h5|h6">
|
||||
<xsl:copy>
|
||||
<xsl:apply-templates select="node()"/>
|
||||
</xsl:copy>
|
||||
|
|
Loading…
Reference in New Issue