This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Converting RSS to HTML
- To: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Subject: [xsl] Converting RSS to HTML
- From: Ronan Brady <Ronan dot Brady at Mobileaware dot com>
- Date: Tue, 20 Feb 2001 16:13:51 -0000
- Reply-To: xsl-list at lists dot mulberrytech dot com
I'm trying to convert from RSS 1.0 to HTML, but I'm having serious trouble
selecting elements from the RSS file.
Specifically, the element <rdf:RDF> is causing me problems because it's
qualified by a namespace.
I'm using XALAN/JAVA for the transformation.
If I change the RSS XML so the element isn't qualified by a namespace I can
write an XSL that does the transformation no problem. How should I
correctly select a namespace qualified element????
Thanks in advance for the help,
Ronan.
<!-- ********************************************** -->
<!-- My RSS File -->
<!-- ********************************************** -->
<?xml version='1.0'?>
<?xml-stylesheet type="text/xsl" href="basic.xsl" ?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/"
>
<channel rdf:about="http://www.xml.com/xml/news.rss">
<title>XML.com</title>
<link>http://xml.com/pub</link>
<description>
XML.com features a rich mix of information and services
for the XML community.
</description>
<image rdf:resource="http://xml.com/universal/images/xml_tiny.gif" />
<items>
<rdf:Seq>
<rdf:li resource="http://xml.com/pub/2000/08/09/xslt/xslt.html" />
<rdf:li resource="http://xml.com/pub/2000/08/09/rdfdb/index.html" />
</rdf:Seq>
</items>
</channel>
<image rdf:about="http://xml.com/universal/images/xml_tiny.gif">
<title>XML.com</title>
<link>http://www.xml.com</link>
<url>http://xml.com/universal/images/xml_tiny.gif</url>
</image>
<item rdf:about="http://xml.com/pub/2000/08/09/xslt/xslt.html">
<title>Processing Inclusions with XSLT</title>
<link>http://xml.com/pub/2000/08/09/xslt/xslt.html</link>
<description>
Processing document inclusions with general XML tools can be
problematic. This article proposes a way of preserving inclusion
information through SAX-based processing.
</description>
</item>
<item rdf:about="http://xml.com/pub/2000/08/09/rdfdb/index.html">
<title>Putting RDF to Work</title>
<link>http://xml.com/pub/2000/08/09/rdfdb/index.html</link>
<description>
Tool and API support for the Resource Description Framework
is slowly coming of age. Edd Dumbill takes a look at RDFDB,
one of the most exciting new RDF toolkits.
</description>
</item>
</rdf:RDF>
<!-- ********************************************** -->
<!-- XSL File -->
<!-- ********************************************** -->
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<xsl:template match="/channel">
<table CELLSPACING="1" CELLPADDING="4" BGCOLOR="#FFFFFF"
BORDER="0" width="100%">
<tr>
<td valign="middle" align="center" bgcolor="#EEEEEE"><font
color="#000000" face="Arial,Helvetica"><b>
<xsl:param name="href" expr="link"/>
<a href="{$href}"><xsl:value-of
select="title"/></a></b></font></td>
</tr>
</table>
</xsl:template>
<xsl:template match='/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="rdf:RDF">
<html>
<body>
<table bgcolor="#000000" border="0" width="200">
<tr>
<td>
<xsl:apply-templates select="channel"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
<xsl:template match='/">
<xsl:apply-templates />
</xsl:template>
</xsl:stylesheet>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list