XML Development

Moderators: None (Apply to moderate this forum)
Number of threads: 252
Number of posts: 451

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Suggestions for why this XSLT isn't working? Posted by boycetrus on 7 Apr 2010 at 9:19 PM
I'm a relative beginner when it comes to XSLT but I thought this would be a fairly straightforward example. I'm just trying to render the items from an RSS feed as a simple unordered list <ul>. It doesn't, however, return any results and I can't work out why.

here's the xslt code

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited by XMLSpy® -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
  <html>
  <body>
  <h2>DLG Circulars</h2>
    <ul>
       <xsl:for-each select="rss/channel/item/">
       <li><a href="<xsl:value-of select="link"/>">
             <xsl:value-of select="title"/></a>
             <br />
             <xsl:value-of select="description"/>
       </li>
       </xsl:for-each>
    </ul>
  </body>
  </html>
</xsl:template>
</xsl:stylesheet>


and here's a portion of the source rss/xml file:
<?xml version="1.0"?>
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">
   <channel>
      <title>DLG Circulars</title>
      <description>Circulars from the Department of Local Government</description>
      <link>http://pipes.yahoo.com/pipes/pipe.info?_id=61096c12df0a4826a0c39f6b85da0ead</link>
      <pubDate>Wed, 07 Apr 2010 20:44:50 -0700</pubDate>
      <generator>http://pipes.yahoo.com/pipes/</generator>

      <item>
         <title>Walk Safely to School Day (28 kb)</title>
         <link>http://www.dlg.nsw.gov.au/dlg/dlghome/documents/Circulars/10-07.pdf</link>
         <description>Circular, Ref : 10-07</description>
         <guid isPermaLink="false">http://www.dlg.nsw.gov.au/dlg/dlghome/documents/Circulars/10-07.pdf</guid>
         <pubDate>Tue, 06 Apr 2010 17:00:00 -0700</pubDate>
         <media:thumbnail url="http://www.dlg.nsw.gov.au/images/dlglogo.gif"/>
         <category>DLG</category>
      </item>
      <item>
         <title>Characteristics Of Candidates And Councillors 2008 (38 kb)</title>
         <link>http://www.dlg.nsw.gov.au/dlg/dlghome/documents/Circulars/10-06.pdf</link>
         <description>Circular, Ref : 10-06</description>
         <guid isPermaLink="false">http://www.dlg.nsw.gov.au/dlg/dlghome/documents/Circulars/10-06.pdf</guid>
         <pubDate>Thu, 04 Mar 2010 16:00:00 -0800</pubDate>
         <media:thumbnail url="http://www.dlg.nsw.gov.au/images/dlglogo.gif"/>
         <category>DLG</category>
      </item>
      <item>
         <title>Updated guidelines on the exercise of functions under CA Act 1998 and Companion Animals Frequently Asked Questions (49 kb)</title>
         <link>http://www.dlg.nsw.gov.au/dlg/dlghome/documents/Circulars/10-05.pdf</link>
         <description>Circular, Ref : 10-05</description>
         <guid isPermaLink="false">http://www.dlg.nsw.gov.au/dlg/dlghome/documents/Circulars/10-05.pdf</guid>
         <pubDate>Thu, 04 Mar 2010 16:00:00 -0800</pubDate>
         <media:thumbnail url="http://www.dlg.nsw.gov.au/images/dlglogo.gif"/>
         <category>DLG</category>
      </item>

   </channel>
</rss>


what have I done wrong?



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.