my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes Consuming RSS Feeds using XSL Only Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Consuming RSS Feeds using XSL Only" Watch "Consuming RSS Feeds using XSL Only" New topic
Author

Consuming RSS Feeds using XSL Only

Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 382
I have found that most of websites shows Consuming RSS Feeds,
but every website is showing consumption using
> some DOT NET Code,
> Java Code
> Javascript Code
> Also seen some Umbraco code (don't know what is that)

still all are third party

Question 1: Do we always need some third party other than XSLT (i.e Java, .NET or Umbraco) to read RSS from particular Site?
Question 2: Doesn't XSLT have some command which Ping RSS Server and bring feed to XML? If yes then could anyone show some working code?

Is this procedure correct to call/process RSS?
RSS FEED -> Called by Third Party Code -> Make XML On Disk -> User make XSL on Disk -> Transform XML/XSL -> Show Output in User Defined form ?


Regards
Azrael Noor
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Seems to me that if the RSS feed produces valid XML, then you could consume the XML directly from the feed (i.e. over the network). There's no need to copy it to a local disk before you transform it.

The other issue: if the RSS feed is Atom, then it's valid XML and you can transform it with XSLT. However earlier RSS formats were not valid XML, so you won't be able to transform them with XSLT. And they are still very common out in the wild. You might be able to preprocess them with JTidy or some other product which cleans up HTML -- or maybe not. I'm not sure that those formats would be amenable to that sort of cleanup.

There was also a Java RSS parser named ROME, which you might be able to track down.
Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 382
I thank you for your reply, put some light to issue :)

Paul Clapham wrote:Seems to me that if the RSS feed produces valid XML, then you could consume the XML directly from the feed (i.e. over the network). There's no need to copy it to a local disk before you transform it.


1) Do you mean to say that we should write some code directly in XSLT, contains link from where it has to consume Feed? What code could we write in XSLT so that it consume feed directly from Network? I am not able to find that code (found some umbraco like things, but it is again third party library So i used third party(Dot Net,Java) to consume feed first and store at local disk).

>> And you are right may be i do not need to store it at local disk and just bring Feed on fly and write XSL and transform it.


Paul Clapham wrote:The other issue: if the RSS feed is Atom, then it's valid XML and you can transform it with XSLT. However earlier RSS formats were not valid XML, so you won't be able to transform them with XSLT. And they are still very common out in the wild. You might be able to preprocess them with JTidy or some other product which cleans up HTML -- or maybe not. I'm not sure that those formats would be amenable to that sort of cleanup.

There was also a Java RSS parser named ROME, which you might be able to track down.


Thank you for information. Still i was looking like no need of java or dot net.

Just a code in XSL/XPATH which directly get feed over network and XSL transformed into my html. :)
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Azrael Noor wrote:1) Do you mean to say that we should write some code directly in XSLT, contains link from where it has to consume Feed?


No, that wasn't what I meant to say.

But now that I read your original post again, it almost looks like you want to run the XSLT directly, without using any other code in any other language. Is that right? If so, then before we continue it would be useful to understand why you think this is a good idea.
Azrael Noor
Ranch Hand

Joined: Jul 29, 2010
Posts: 382
No, that wasn't what I meant to say.

But now that I read your original post again, it almost looks like you want to run the XSLT directly, without using any other code in any other language. Is that right? If so, then before we continue it would be useful to understand why you think this is a good idea.


Two Points

1) XSLT - The transformation can be done using Transformers like Saxon (have heard browsers also transform XML/XSL to HTML), but unable to do so
2) Reading RSS Feed: My main motive is to consume RSS feed using XSLT technology only, neither Java nor Dot Net. Is there any thing in XSLT which consume feed directly or is XSLT able to read feed directly by just supplying address to it? If yes how?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

XSLT always has an input document, which must be well-formed XML. And you always have to do something outside XSLT to configure where this document is located. If you don't, then there's no input document.

However you can use the document() function to read other XML documents, and it might be possible to do that even if there's no input document.

But I asked the questions I did because it wasn't clear to me whether you wanted to avoid using any other language to set up the input document for some particular reason, or whether that was just because you didn't know how XSLT worked. So if you don't have a requirement which prevents you from telling the XSLT document where its input comes from, I suggest you just do that. There are many ways of doing it.

Note also that the input document doesn't have to come from a file. In general you provide a URL, which can point to a local file or to a resource on the web.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Consuming RSS Feeds using XSL Only
 
Similar Threads
XML Development RSS and Atom Feeds
creating pdf,xml,doc file using servlet
Security in RSS Feeds
A Beginner's Question
Content Syndication with RSS by Ben Hammersley