Author |
Topic |
|
altisdesign
Junior Member
United Kingdom
357 Posts |
Posted - 19 September 2003 : 20:32:45
|
I've been reading up on XML and RSS, and I can do ASP, so I'm playing around with trying to retrieve XML information (news headlines) which are in an RSS form. I've looked at lots of 4guys articles, which is what my code is based on, and also looked at w3schools, searched this forum and sitepoint, but to no avail. I'm trying to use the following XML file: http://www.computerworld.com/news/xml/10/0,5009,,00.xml
The page that should display the results is located at www.ianbergson.com/evan - This should display the headline URL, this is not the finished product of the page, just a test to see if it would work. However, as you can see, it doesnt, I just get a blank table and nothing else. I've messed around with my XSL file to see if I could get it to work, because it appears to load the XML file successfully, but not parse it into XML as it should so then nothing gets displayed Does anyone have any experience with this and ASP?
This is the ASP page I'm using: www.ianbergson.com/evan/index.asp.txt" target="_blank">http://www.ianbergson.com/evan/index.asp.txt
This is the XSL file I'm using: www.ianbergson.com/evan/home.xsl" target="_blank">http://www.ianbergson.com/evan/home.xsl
Can anyone tell me what I'm doing wrong and why it doesn't work? I'm at a loss . I wondered if it could be a difference between pure XML and RSS, but I'm not sure.
Many Thanks in advance -Altis Design |
Altis Design offers all manner of web design services to a variety of commercial and personal clients |
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 20 September 2003 : 09:56:23
|
It's probably in the XSL transformation, try just response.writing out the results after you've grabbed the XML/RSS to make sure thats correct first, if it is then work through your XSL and check thats correct.
I use something like this for RSS feeds myself
set xmlDoc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
xmlDoc.validateOnParse = false
xmlDoc.async = false
xmlDoc.resolveExternals = true
strSql = "SELECT FEED_XML FROM NEWS_FEEDS WHERE FEED_SITE='" & strNewsFeed & "'"
set sqlXml = my_Conn.Execute(strSql)
xmlDoc.loadXML(sqlXml("FEED_XML"))
set xmlStyle = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
xmlStyle.validateOnParse = false
xmlStyle.resolveExternals = false
xmlStyle.async = false
xmlStyle.load(Server.MapPath("news.xsl"))
xslTest = xmlDoc.transformNode(xmlStyle)
Response.Write(xslTest)
set xmlDoc = nothing
set sqlXml = nothing
And the XSL is here http://haloguild.com/forum/news.xsl
What I'm pulling from the database is just an RSS feed I've retrieved previously using XMLHTTP like you do but, I just store it in my DB for using later. |
Kiwihosting.Net - The Forum Hosting Specialists
|
Edited by - Gremlin on 20 September 2003 09:57:48 |
|
|
altisdesign
Junior Member
United Kingdom
357 Posts |
Posted - 21 September 2003 : 07:36:37
|
Thanks for the reply gremlin, appreciate it
Do you have a sample copy of a small amount of the xml you are getting from the database? I'd be interested to see what it looks like.
I carried out your suggestion, and in the above scripts it is getting the XML input into the ASP script using the component correcty - I can response.write out the XML in raw form. Therfore I'm guessing the problem has to be with the XSL, like you said. The thing is, I can't see anything wrong with it - there seems to be nothing that would cause no records to be returned like what is happening. I've checked it several times, but this is my first try and I'm pretty new at this. What I wondered was if the syntax for and XSL document is different if you are reading RSS, not "straight" XML. I used <xsl:for-each select="rss/channel/item"> to loop through the items, (http://www.ianbergson.com/evan/home.xsl) and I suspect here in lies the problem. Does anyone know how I would change the XSL document to work above?
Many thanks in advance |
Altis Design offers all manner of web design services to a variety of commercial and personal clients |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
|
altisdesign
Junior Member
United Kingdom
357 Posts |
Posted - 21 September 2003 : 18:50:59
|
Is the syntax for an RSS file different to that if you are reading straight XML? I could see this as the only thing that is stopping the script from working, because the XSL works for XML files (because I wrote it by following a tutorial at 4guysfromrolla.com) |
Altis Design offers all manner of web design services to a variety of commercial and personal clients |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 22 September 2003 : 07:03:47
|
An RSS file conforms to XML, so its both an RSS file and an XML file really.
Your XSL will most likely need to be change though to look for the specifc field names contained in the RSS file, there are different versions of RSS as well the 4guys stuff may have been targeted at an earlier version perhaps. I know with my stuff I've not yet found an RSS file it didn't seem to work ok with anyway.
|
Kiwihosting.Net - The Forum Hosting Specialists
|
|
|
|
Topic |
|