Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible? 1 XML file supplying content for html and rss feed 1

Status
Not open for further replies.

tombrew

Technical User
Sep 10, 2007
3
0
0
GB
Hi guys, thanks for reading.

As the subject sort of explains, I want to be able to control the content of a HTML file and an RSS feed from one XML file.

What I am making is a noticeboard web-page. I want to be able to alter the posts easily and quickly as the person updating the noticeboard (my dad) is not html-literate.

Therefore I want to only edit one file (an XML file preferably) and for these changes to then be reflected on the HTML page.

I am hoping that the XML file I create can also be the XML file that I can use as a RSS feed.

I have made an XML file and attached an XSL style sheet to it , and this does what I want as far as displaying the noticeboard page but.....the XML document is invalid for use as an RSS feed.

By making the XML document valid for syndication, I loose the ability to apply a XSL style sheet to it.

I hope I haven't waffled on too much, but I would really appreciate it if anybody could shed some light on this.

Is what I'm trying to do possible? If not what do you recommend I try instead?

Thanks very much
Tom

 
Yes this is possible. Easiest way is to make the RSS file and use XSL to produce the HTML.

Post your files that you having trouble with.

A better solution is to do the transform server-side. Know any server-side programming languages?

Jon

"I don't regret this, but I both rue and lament it.
 
Thanks for getting back to me Jon,

I've zipped up my XML, XSL and CSS file and stuck them on my webserver here:


I don't know much server-side programming but if it meant the solution would be better, I'd be willing to learn...as long as it wasn't too deep....im a designer, code scares me.

Your input is much appreciated

Cheers,

Tom
 
Whilst you can use the xml-stylesheet declaration to perform a client-side transform, both IE7 and firefox will display RSS feeds with their custom stylesheets. You can this off in IE, but by default it is on - so server-side is the only real choice.

Create a new text file called "noticeboard.asp" and paste in the following:
Code:
<%
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(Server.MapPath("noticeboard.xml"))

set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(Server.MapPath("noticeboard.xsl"))

Response.Write(xml.transformNode(xsl))
%>
To make it work, you'll need to get rid of the entity declarations in the XSL (and replace with appropriate numbered entity eg &#160;).

Jon

"I don't regret this, but I both rue and lament it.
 
Thanks very much, I'll give that a go.

Cheers,

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top