If you have stylesheets for the individual flavours, it would be easy to
include them into a single master stylesheet and run the appropriate one
based on a version attribute etc. And you could run the input through
Tidy first to guarantee well-formed xml.


-----Original Message-----
From: Code for Libraries [mailto:[log in to unmask]] On Behalf Of
Roy Tennant
Sent: Thursday, March 16, 2006 12:38 PM
To: [log in to unmask]
Subject: Re: [CODE4LIB] XSLT for RSS

Thank you all for your feedback, both public and private. The
response was universal: it would be better to handle this with code
rather than XSLT, and the best method would be a web services model
where you pass in a URL for a feed and get back standard output,
letting the code handle invalid XML and all the variant forms of RSS.
This is exactly the solution I would like to use, and will continue
to advocate with the powers that be. In this particular instance, I
must be a team player and not just go and do it myself. Meanwhile, in
the short-term I decided to hand-select the appropriate stylesheet
for the specific feed rather than try to write a stylesheet that
could handle anything. That will work for now, but before long I'll
need to have an easier and less fragile method such as the ones you
suggested. Thanks,

On Mar 15, 2006, at 3:45 PM, Alexander Johannesen wrote:

> On 3/16/06, Roy Tennant <[log in to unmask]> wrote:
>> I'm looking for an XSLT that can detect which version of RSS it is
>> being handed and process it appropriately so I end up with the same
>> elements out the back no matter what RSS format it was
> I don't think XSLT is the way to go on this, given that RSS isn't
> always XML nor comes with guarantees of valid nor well-formedness;
> your XSLT processor will break. I'd rather do a simple snoop on the
> version number, check for well-formedness and *then* possibly send it
> to an XSLT script. Also remember that RSS:RDF is a very different
> beast to RSS 2.0 for example. My suggested way to handle this is to
> convert any RSS feed through a series of PHP/Perl/Ruby/Whatever
> scripts to a compliant Atom 1.0 feed, and handle *that* through XSLT.
> Alex
> --
> "Ultimately, all things are known because you want to believe you
> know."
>                                                          - Frank
> Herbert
> __
> __________________________________________________