Primer/How To for XML, XSL, and RSS feeds?

  • Thread starter Pako
  • 9 comments
  • 639 views

Pako

Staff Emeritus
16,455
United States
NW Montana
GTP-Pako
GTP Pako
Does anyone know of any simple howto's for these topics? I'm seeing more and more RSS feeds that appear in XML format, and from what I understand you need a XSL (XML Style Sheet) to format the data to create a legible HTML document.

Any help in this area would be great.

Anyone?
 
So, are you saying you want to take an RSS feed and format it as an HTML document? Err, why? (That takes all the usefullness out of RSS. ;)) RSS and Atom feeds are normally fed as XML, because that's what the RSS readers actually parse (that is, an XML document is sent to the feed reader, and it interprets that document just fine – if you were to make it an HTML document, the reader wouldn't be able to use it).
 
I want the RSS feed or XML document to be incorporated into a HTML document so that I can have all that nice formatting, or am I totally confused? Maybe I don't want a HTML doc, but rather a XSL document to display the data? :dunce:
 
No, you definitely don't want an XSL document ;) – only the Gecko family has full support for inline XSL. And it's horribly messy and complicated.

What I'm confused about though is why you'd want to incorporate an RSS feed into an HTML document – it's a rather backwards way of doing things. Usually, whatever software you're using will draw information from a database to create the RSS feed, and draw from the same database to create your website. What you're saying you want to do would be like making an image of text and then trying to transform it into an Word doc.


Unless I'm still not understanding exactly what you're doing? ;)

[edit]: Well, I just thought of something – are you mistaking RSS as the source of information for a website (as in, in lieu of a DB)?
 
Well.... Ok, "And here's the rest of the story..."

A real estate client wants me to design a site for her. Not a problem, I even have some perl scripted listing software that I can dress up and get her taken care of. Then I find out that she's a member of a existing real estate site that she uploads all her listings to, and wants me to use them has a hosting service because she likes them, but doesn't want them to design it (not sure why, think maybe they just dragged their feet too long), anyways so in talking with the prospective hosting company, he figures that I am 're-inventing the wheel' and suggests I just use XSL from XML sheets to draw her specific listings from their site into her specific site that I'm commissioned to design for her.

This sounds like a good idea for her because she would only need to update and maintain one house listing and not two. I'm trying to educate myself with XML/XSL so I can ask the right questions for this particular project.

Hope this all makes sense.

:cheers:
 
No, but aparently, the site can create XML docs of her current listings, and I'm supposed to be able to use those XML docs using XSL to display her listings on her site. Quite odd, but yes that's the jest of it.
 
Ahhh, okay.

In that case, yes, I guess you'd want to use XSL to accomplish what you want (why they don't use a DB is beyond me though – so much simpler).

I have, and definitely recommend, Elizabeth Castro's XML for the World Wide Web, which also touches on XSL and XSLT.

Now, the difficult part is not the XML or XSL itself – the hard part is the XSLT (the t stands for transform). You can't just create an XML document, attach an XSL document to it, and hope that a web browser will be able to read it (as you would attach a CSS doc to an HTML doc). You need a processor that will take this information and spit out an HTML document.

I'm not sure how much you've looked into XML and XSL, but it basically works like this:

XML Document: <something>information</something>

XSL Document: Find the <something> tags, take the information within them, and format it like this: <p class="something">information</p>

The p and class are purely for example – you can have anything there. You could even have something like this:

XML: <start>Title</start>

XSL: Find the <start> tags, take the Title, and format it like this: <html><head><title>Title</title></head><body>

Like I said though, the tricky part is processing the XSL so that you get a nice HTML document that any browser can read. (Writing the XML and XSL itself isn't particularly hard, and that book will tell you everything you need to know – it's definitely too involved though to explain in one post. ;)) SitePoint has an article on using PHP to transform XSL, but that's the only server-side way I happen to know of. (I definitely wouldn't know how to do it in Perl if that's what you have to use.)

The hope is that eventually web browsers will be XSL processors themselves (like Firefox already is), but until then you have to rely on server-side junk to do it.
 
Well...that is making sense to me now. From the looks of it, they have better got some templates that a guy can build from if sites are expected to use their design and architecture.

Thanks for the help. This is the 'basic' info I was looking for.

:cheers:
 
Pako
Well...that is making sense to me now. From the looks of it, they have better got some templates that a guy can build from if sites are expected to use their design and architecture.
Oh, definitely. The XSLT in particular is far from trivial – might as well write your own stinkin' CMS if you're going to go through that much trouble. :P (Not "you" as in you, but the people at this company who decided it was a good idea to use XML in the first place.) It sounds like they're trying a little too hard to be "forward thinking" – XML is really too complicated for most usage until all browsers can be transformers themselves.

Thanks for the help. This is the 'basic' info I was looking for.
You're welcome. :)
 
Back