You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Jacob Hookom <ho...@uwec.edu> on 2002/12/29 22:01:25 UTC

RSS Transformation-- Namespace Issue?

Hello,
 
I'm trying to transform the Slashdot RSS feed via an XSL File posted at
IBM's DevZone:
 
http://slashdot.org/slashdot.rss
 
http://www-106.ibm.com/developerworks/xml/library/x-tiphdln.html?dwzone=
xml
 
I'm able to pull in the feed from Slashdot easily and I'm able to grab
the first node and output its namespace-uri as a test, but, trying to
select any of the channels or items returns nothing:
 
<?xml version="1.0"?> 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html"/>
 
<xsl:template match="/">
  <h1><xsl:value-of select="namespace-uri(.)"/></h1>
  <xsl:apply-templates select="//channel"/>
  <ul>
    <xsl:apply-templates select="//item"/>
  </ul>
</xsl:template>
 
<xsl:template match="channel">
<xsl:apply-templates select="../image"/>
 <h2><xsl:value-of select="title"/></h2>
 <h3><xsl:value-of select="description"/></h3>
</xsl:template>
 
<xsl:template match="item">
  <li>
    <xsl:element name="a">
      <xsl:attribute name="href"><xsl:value-of
select="link"/></xsl:attribute>
      <xsl:value-of select="title" />
    </xsl:element>
  </li>
</xsl:template>
 
<xsl:template match="image">
  <xsl:element name="img">
    <xsl:attribute name="src"><xsl:value-of
select="url"/></xsl:attribute>
    <xsl:attribute name="style">float:left; padding:
10px;</xsl:attribute>
  </xsl:element>
</xsl:template>
 
<xsl:template match="language">
</xsl:template>
 
</xsl:stylesheet>
 
Returns:
 
<h1>http://www.w3.org/1999/02/22-rdf-syntax-ns#</h1>
<ul></ul>
 
I'm wondering if I need to put a namespace item in my XSL sheet or
something.
 
Any help would be greatly appreciated!
Jacob Hookom