[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Converting RSS to HTML

Subject: Converting RSS to HTML
From: Ronan Brady <Ronan.Brady@xxxxxxxxxxxxxxx>
Date: Tue, 20 Feb 2001 16:13:51 -0000
converting rss to html
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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.