HTML and CSS Reference
In-Depth Information
Similarly, further styles can be set for other RSS elements. Much information is not always relevant and can be
omitted, as for example in Listing 8-32.
Listing 8-32. Hiding RSS Elements with CSS
channel link, channel language, channel copyright, channel managingEditor,
channel webMaster, channel docs, channel lastBuildDate {
display: none;
}
The second approach applies XSL Transformation, which provides more control. For example, hyperlinks can be
activated, and node order can be changed. The XSL file can be linked as shown in Listing 8-33.
Listing 8-33. Using XSLT for Styling RSS
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="css/feed.xsl" ?>
<rss version="2.0">
additional functionality such as searching or category listings provided by the built-in rSS reader of some
browsers are not available when a custom style sheet is applied to a news feed.
Note
Atom
The Atom news feed specification consists of two standards: the Atom Syndication Format and the Atom Publishing
Protocol (AtomPub or APP). The first one is a web feed format in XML syntax defined by an IETF proposed standard
(RFC 4287 [17]). The second one is an HTTP-based protocol that can be used for creating and updating web resources.
It is also a proposed standard (RFC 5023 [18]). This section focuses on the Atom Syndication Format.
The file extensions of Atom feeds are .atom and .xml . The Internet media type of Atom is application/atom+xml .
The Atom namespace is http://www.w3.org/2005/Atom .
Creating an Atom File
Atom files begin with an XML declaration. The root element of Atom files and the container of news feed entries
( entry elements) is the feed element. Listing 8-34 shows the general structure of an Atom file.
Listing 8-34. General Structure of an Atom File
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns=" http://www.w3.org/2005/Atom " >
<title>An Atom news feed example</title>
<link rel="alternate" type="text/html" href="http://www.example.com/" />
<link rel="self" type="application/atom+xml" href="http://www.example.com/News/atom.xml" />
<id>tag:www.example.com,2008-09-29://4</id>
<updated>2011-08-08T08:03:00Z</updated>
<entry>
<title>News item 2</title>
<link rel="alternate" type="text/html" href="http://www.expl.com/2011.html#entry-9167" />
<id>tag:www.expl.com,2011://4.9167</id>
 
 
Search WWH ::




Custom Search