RSS und Atom Feed

Web-Feeds wie der RSS und der Atom-Feed sind eine Möglichkeit Benutzer auf Änderungen der Web-Site aufmerksam zu machen.

Es gibt diese zwei gebräuchliche auf XML basierende Formate, zu denen spezielle Newsreader/Feedreader existieren, aber auch eine Darstellung im Browser ist möglich. Häufig werden diese Feeds auch von Nachrichten-Webseiten genutzt, um Inhalte weiterzuverbreiten.

Eine umfangreiche Erklärung der beiden Formate mit ihren Unterschieden findet ihr unter RSS 2.0 und Atom 1.0 im Vergleich (Sam Ruby et al.).

Während für die beiden Formate sich die beiden MIME-Typs application/rss+xml und application/atom+xml für die Feedreader anbieten, führt dieses bei Browsern in der Regel lediglich dazu, das nur ein Download möglich ist, wo hingegen eine Auslieferung mit dem MIME-Typ application/xml oder das Weglassen des MIME-Types im HTTP-Header eine Anzeige ermöglicht.

Eine Gestaltung ist über XSLT möglich.

Es gibt mit XSLT einige Gestaltungsmöglichkeiten für XML-Dateien, die natürlich referenziert werden muss, gibt es ein ansprechendes Ergebnis.

Beispiel: /atom.xml, /atom.xsl

Atom-Feed ohne XSLT
Atom-Feed ohne XSLT
zoom

RSS / Atom Feed mit XSLT

RSS / Atom Feed mit XSLT
RSS / Atom Feed mit XSLT
zoom

RSS / Atom Feed mit XSLT

In der atom.xml Datei muss dazu lediglich eine Zeile eingefügt werden und zwar vor dem feed:

<?xml-stylesheet type="text/xsl" href="/atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de" xml:base="https://www.gocher.me" />

Das Stylesheet atom.xsl sieht dann folgendermaßen aus:

atom.xsl XSL (4,31 kByte) 20.08.2025 08:39
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
  <xsl:output method="html" doctype-system="about:legacy-compat" indent="yes" />
  <xsl:template match="/">
    <html>
      <head>
        <meta charset="utf-8" />
        <title>
          <xsl:value-of select="atom:feed/atom:title" />
        </title>
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <style type="text/css">body {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
h1 {margin: 0; padding: 10px;}
body > img {float: right;}
header, footer {background-color: #f7f7f7; border: 1px solid #aaaaaa; border-right: none; border-left: none; padding: 5px 10px; margin: 10px 0; line-height: 1.7;}
header {clear: both;}
div {padding: 5px 10px; margin: 10px 0;}
div.odd {background-color: #f7f7f7;}
footer {margin-top: 15px;}
        </style>
      </head>
      <body>
        <img>
          <xsl:attribute name="src">
            <xsl:value-of select="atom:feed/atom:logo" />
          </xsl:attribute>
        </img>
        <h1>           
          <xsl:value-of select="atom:feed/atom:title" />
         </h1>
        <header>
          <h2>             
            <xsl:value-of select="atom:feed/atom:subtitle" />
           </h2>
          <p>This Atom feed, with             
            <xsl:value-of select="count(atom:feed/atom:entry)" />
 items, was created using UDOs Webserver 0.5.2.9, developed by Udo Schmal.             
            <br />
             
            <a>               
              <xsl:attribute name="href">                 
                <xsl:value-of select="atom:feed/atom:link[@rel='alternate']/@href" />
               </xsl:attribute>
 Return to website →</a>
           </p>
          <xsl:if test="atom:feed/atom:author/atom:name">
            <p class="author">               
              <xsl:value-of select="atom:feed/atom:author/atom:name" />
               
              <xsl:if test="atom:feed/atom:author/atom:email">                 
                <xsl:text> (</xsl:text>
                 
                <xsl:value-of select="atom:feed/atom:author/atom:email" />
                 
                <xsl:text>)</xsl:text>
               </xsl:if>
             </p>
          </xsl:if>
          <h2>Was ist ein RSS/Atom feed?</h2>
          <p>Ein RSS/Atom feed ist ein Daten-Format, welches Informationen zu aktuellen Änderungen einer Website enthält.</p>
          <p>             
            <strong>Feeds geben Dir die Kontrolle.</strong>
  Anders als bei Social-Media gibt es keine Algorithmen, die entscheiden, was Sie sehen bekommen. Sie erhalten immer die neuesten Inhalte.</p>
          <p>Alles was Du tun musst um es zu nutzen ist die URL (Web-Adresse) zu speichern, ob in einem Brwowser (mit einer speziellen Erweiterung News-/Feed-Reader) oder in einem speziellen Newsreader das bleibt Dir überlassen.</p>
        </header>
        <div id="main">
          <xsl:for-each select="atom:feed/atom:entry">
            <div>
              <xsl:if test="position() mod 2 != 0">
                <xsl:attribute name="class">odd</xsl:attribute>
              </xsl:if>
              <h3>                 
                <a target="_blank">                   
                  <xsl:attribute name="href">                     
                    <xsl:value-of select="atom:id" />
                   </xsl:attribute>
                   
                  <xsl:value-of select="atom:title" />
                 </a>
               </h3>
              <h4>                 
                <xsl:value-of select="atom:subtitle" />
               </h4>
              <xsl:if test="atom:summary">
                <xsl:apply-templates select="atom:summary" />
              </xsl:if>
              <xsl:if test="atom:content">
                <xsl:apply-templates select="atom:content" />
              </xsl:if>
              <p class="published">                 
                <xsl:value-of select="concat(substring(atom:published, 0, 11),concat(' ', substring(atom:published, 12, 5)))" />
               </p>
            </div>
          </xsl:for-each>
        </div>
        <footer>© Copyright 2025 Udo Schmal</footer>
      </body>
    </html>
  </xsl:template>
  <xsl:template match="atom:summary">
    <xsl:apply-templates select="*" />
  </xsl:template>
  <xsl:template match="atom:content">
    <xsl:apply-templates select="*" />
  </xsl:template>
  <xsl:template match="*">
    <xsl:element name="{local-name()}">
      <xsl:copy-of select="@*" />
      <xsl:apply-templates />
    </xsl:element>
  </xsl:template>
</xsl:stylesheet>

Kontakt

Udo Schmal
Udo Schmal

Udo Schmal
Softwareentwickler
Ellerndiek 26
24837 Schleswig
Schleswig-Holstein
Germany




+49 4621 9785538
+49 1575 0663676
+49 4621 9785539
SMS
WhatsApp

Google Maps Profile
Instagram Profile
vCard 2.1, vCard 3.0, vCard 4.0

Service Infos

CMS Info

Product Name:
UDOs Webserver
Version:
0.5.2.18
Description:
All in one Webserver
Copyright:
Udo Schmal
Compilation:
Sat, 23. Aug 2025 00:06:43

Development Info

Compiler:
Free Pascal FPC 3.3.1
compiled for:
OS:Linux, CPU:x86_64

System Info

OS:
Ubuntu 24.04.2 LTS (Noble Numbat)

Hardware Info

Model:
Hewlett-Packard HP Pavilion dm4 Notebook PC
CPU Name:
Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
CPU Type:
x86_64, 1 physical CPU(s), 2 Core(s), 4 logical CPU(s), max 3000.0000 MHz