Datasheet

Williams c01.tex V3 - 07/31/2009 2:53pm Page 22
Chapter 1: First Steps with XSLT
Listing 1-6: (continued)
</rdf:RDF>
</xsl:template>
<xsl:template match
=
"entry">
<item>
<xsl:attribute name
=
"rdf:about">
<xsl:value-of select
=
"id"/>
</xsl:attribute>
<link>
<xsl:value-of select
=
"link/@href"/>
</link>
<dc:language>
<xsl:value-of select
=
"content/@xml:lang"/>
</dc: language >
<dc:title>
<xsl:value-of select
=
"title"/>
</dc:title>
<dc:date>
<xsl:value-of select
=
"updated"/>
</dc:date>
<dc:creator>
<xsl:value-of select
=
"author/name"/>
</dc:creator>
<dc:description>
<xsl:value-of select
=
"summary"/>
</dc:description>
<dc:format>
<xsl:value-of select
=
"content/@type"/>
</dc:format>
<xsl:for-each select
=
"category">
<dc:subject>
<xsl:value-of select
=
"./@label"/>
</dc:subject>
</xsl:for-each>
</item>
</xsl:template>
</xsl:stylesheet>
RSS 1.0 Results
To run the transform, add a scenario in the Oxygen IDE, using
atom.xml
as the source, and
rss_feed.xsl
as the stylesheet.
Listing 1-7 shows a matching fragment of the transformed RSS 1.0 feed.
Listing 1-7
<?xml version
=
"1.0" encoding
=
"UTF-8"?>
<rdf:RDF xmlns:dc
=
"http://purl.org/dc/elements/1.1/"
xmlns:rdf
=
"http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<channel rdf:about
=
"http://feeds.oreilly.com/oreilly/xml">
<title>O’Reilly News: XML</title>
22