blob: a458bb7ca6dc7edad2cdb669d392efe09a7ad1c1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
<!--
Replaces newline characters in description field of Slashdot's RDF/RSS feed with html linebreaks (`<br>`)
Uses xsltproc (part of libxslt)
Can be used with a filter url, for example:
"filter:xsltproc /usr/share/doc/newsboat/contrib/slashdot-replace-newlines.xslt -:https://rss.slashdot.org/Slashdot/slashdotMain"
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:purl="http://purl.org/rss/1.0/">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="purl:description">
<xsl:copy>
<!-- ' ' encodes a newline character (\n) -->
<xsl:value-of select="str:replace(node(), ' ', '<br>')"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
|