• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Consuming RSS Feeds using XSL Only

 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?

 
Sheriff
Posts: 28385
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 28385
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 28385
99
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic