•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the RSS, Web Services and SOAP section within the Web Development category of DaniWeb, a massive community of 422,667 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,667 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our RSS, Web Services and SOAP advertiser: Programming Forums
Views: 3282 | Replies: 1 | Solved
![]() |
•
•
Join Date: Feb 2005
Location: Staffordshire, England
Posts: 46
Reputation:
Rep Power: 4
Solved Threads: 1
Hello...I've been trying to figure out this problem for most of the week - it's my second attempt at any XML and my first at XSLT so I haven't got a complete grasp of what I'm doing yet. Any help will be muchly appreciated. 
The problem is, the code below validates and works in IE7 (obviously with their pre-set stylesheet). In IE6 the text describing the feed from the XSL file displays, but none of the actual news items between the
There is a way it DOES work in IE6 and Firefox 1.5, but doesn't work in IE7 (I'll explain below the code).
news-test.asp (generated with ASP and with company info removed):
news-feed.xsl:
It works in IE6 and Firefox but DOESN'T display in IE7 ("internet explorer does not support this feed format") if I change the namespace declaration from
to
or infact if I add any bit of random text like
Thanks for looking.

The problem is, the code below validates and works in IE7 (obviously with their pre-set stylesheet). In IE6 the text describing the feed from the XSL file displays, but none of the actual news items between the
<entry> tags of the XML file do i.e. the whole point of having the feed!There is a way it DOES work in IE6 and Firefox 1.5, but doesn't work in IE7 (I'll explain below the code).
news-test.asp (generated with ASP and with company info removed):
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="news-feed.xsl"?>
<feed xmlns:atom="http://www.w3.org/2005/Atom">
<title>-- Latest News</title>
<updated>2008-01-11T11:00:00+00:00</updated>
<id>tag:www.--.co.uk,2007-12-03:/news.asp</id>
<link rel="alternate" href="http://www.--.co.uk/news.asp"/>
<link rel="self" href="http://www.--.co.uk/news-feed.asp"/>
<rights>--</rights>
<logo>http://www.--.co.uk/feed/logo.gif</logo>
<author>
<name>--</name>
<uri>http://www.--.co.uk</uri>
</author>
<entry>
<title>Title</title>
<link rel="alternate" href="http://www.--.co.uk/news_story.asp?id=2197"/>
<content type="html"><![CDATA[Blah blah blah...]]></content>
<id>tag:www.--.co.uk,2007-12-03:/news_story.asp?id=2197</id>
<updated>2008-01-11T11:00:00+00:00</updated>
</entry>
<entry>
<title>Title</title>
<link rel="alternate" href="http://www.--.co.uk/news_story.asp?id=2196"/>
<content type="html"><![CDATA[Blah blah blah...]]></content>
<id>tag:www.--.co.uk,2007-12-03:/news_story.asp?id=2196</id>
<updated>2008-01-10T16:50:00+00:00</updated>
</entry>
<entry>
<title>Title</title>
<link rel="alternate" href="http://www.--.co.uk/news_story.asp?id=2195"/>
<content type="html"><![CDATA[Blah blah blah...]]></content>
<id>tag:www.--.co.uk,2007-12-03:/news_story.asp?id=2195</id>
<updated>2008-01-10T14:49:00+00:00</updated>
</entry>
</feed>news-feed.xsl:
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.0 Transitional//EN"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <body style="font-family: Arial,helvetica,sans-serif; background-color:#ffffff"> <h2 style="color: #ff3300;">PPP/PFI News</h2> <div style="font-size: 0.8em; margin: 0.5em 0em 1em 0em;"> This page is for the <a href="http://www.--.co.uk">www.--.co.uk</a> News syndication feed. Feeds allow you to stay up to date with the latest news and features by adding the feed address to a news aggregator program, or to your own website. <br /><br />There are various ways to subscribe, including: <ul><li>Dragging the orange feed button (<a href="news-feed.asp"><img src="feed/feed.gif" border="0" width="16" height="16" hspace="1" style="vertical-align: middle;" /></a>) or URL of the feed into your News Reader software</li> <li>Cutting and pasting the URL of the feed into your News Reader</li> </ul> The latest content for this feed can be viewed below. </div> <xsl:for-each select="feed/entry"> <div style="color:#000000; padding: 0.3em;"> <h3 style="font-size: 1em; padding: 0em; margin: 0em;"> <a><xsl:attribute name="href"><xsl:value-of select="link/@href"/></xsl:attribute><xsl:value-of select="title" disable-output-escaping="yes"/></a> </h3> </div> <div style="margin-left: 0.5em; margin-bottom: 0.9em; font-size:0.8em;"> <xsl:value-of select="description"/> <span><xsl:value-of select="content"/></span> </div> </xsl:for-each> </body> </html> </xsl:template> </xsl:stylesheet>
It works in IE6 and Firefox but DOESN'T display in IE7 ("internet explorer does not support this feed format") if I change the namespace declaration from
<feed xmlns="http://www.w3.org/2005/Atom">to
<feed xmlns:atom="http://www.w3.org/2005/Atom">or infact if I add any bit of random text like
:aaaaaaaargh thereThanks for looking.
www.last.fm/music/The+Cakes
One day to go!
www.holeinmyhead.co.uk
Gig & travel photos, writing, artwork & other stuff...
One day to go!
www.holeinmyhead.co.uk
Gig & travel photos, writing, artwork & other stuff...
•
•
Join Date: Feb 2005
Location: Staffordshire, England
Posts: 46
Reputation:
Rep Power: 4
Solved Threads: 1
Solved! And just incase this might help anyone in future, here is the solution from Jeni and her XML pages at www.jenitennison.com
•
•
•
•
The use of the default namespace in the Atom feed means that the <feed>, <entry> etc. elements are in the Atom namespace.
In your stylesheet, you’re doing:
<xsl:for-each select="feed/entry">
...
</xsl:for-each>
When you select elements in XSLT, if you don’t give a prefix for the element then the processor will only look for elements in no namespace. So in this case you’re selecting <feed> elements in no namespace and their <entry> element children (in no namespace again).
You already have the Atom namespace declared in the stylesheet with the prefix atom. The solution is simply to use that prefix whenever you refer to an Atom element:
<xsl:for-each select="atom:feed/atom:entry">
...
</xsl:for-each>
www.last.fm/music/The+Cakes
One day to go!
www.holeinmyhead.co.uk
Gig & travel photos, writing, artwork & other stuff...
One day to go!
www.holeinmyhead.co.uk
Gig & travel photos, writing, artwork & other stuff...
![]() |
•
•
•
•
•
•
•
•
DaniWeb RSS, Web Services and SOAP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
api asp beta blogger blogging bon browser browsers browsing code development dom echo email encryption europe explorer feed firefox gdata google graphics html ie7 internet internet explorer javascript leak linux microsoft mozilla news open source open-source programming reader rss security software standards super testing video w3c weather web webmail xml xoap youtube
- Previous Thread: Adding Attributes to all XML Nodes
- Next Thread: MSSoap SDK 3.0 - Unable to read a SOAP file


Linear Mode