Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Get a handle on RSS URL in XSL

Reply
Thread Tools

Get a handle on RSS URL in XSL

 
 
dirvine
Guest
Posts: n/a
 
      11-08-2006
I want to add a semi-static link in my RSS display page so people can
subscribe to the feed. Note: I do not have control over the RSS feed
itself, just the XSL used to transform (format) it.

I use a {link} variable to get the url of the item (article) in my XSL
file, however, I don't know how to get the url of the RSS feed itself.
Technically, it's not part of the xml data itself so I'm a little
stumped.

We have a bunch of these, so I don't want to hard-code the URL into the
XSL file.

Is there a built-in variable that retrieves the RSS feed's URL?

The desired result would look something like this:

Blog Feed Title
- First article
- Second article
- Third article
Subscribe to this feed (link to rss url)

 
Reply With Quote
 
 
 
 
Joseph Kesselman
Guest
Posts: n/a
 
      11-08-2006
dirvine wrote:
> Is there a built-in variable that retrieves the RSS feed's URL?


XSLT has no knowledge of RSS. Your RSS environment *may* pass that
information in as a parameter or make it available as a function call,
but you'll have to take that up with whoever wrote that software and/or
is running that server.

--
Joe Kesselman / Beware the fury of a patient man. -- John Dryden
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      11-08-2006

dirvine wrote:

> I use a {link} variable to get the url of the item (article) in my XSL
> file, however, I don't know how to get the url of the RSS feed itself.
> Technically, it's not part of the xml data itself so I'm a little
> stumped.


Then you can't get it. XSLT takes one XML input document and applies an
XSLT transform (also an XML document) to it. That's pretty much your
lot - there's no useful "environment" to access properties from. You
have the document() function, but that's really just swapping one XML
input fragment for another. You can also get up to all sorts of
mischief with extension functions, but they're likely to give you a
complicated and unstable solution.

In practice you have two viable options: First is to embed all the
necessary information in the input XML document, and I mean
_everything_. For heavy-duty CMS tasks, this is usually the best
approach.

Secondly you could use a parameter in the XSL. This may be preferable
and more "lightweight" because your XSL transform engine might offer a
simple API for setting it from outside the transform before you start,
without having to re-parse / compile the stylesheet. Even if it
doesn't, it's still just an XML document -- make the <xslaram>
element easy to locate (maybe using an id attribute) and then you can
set it through an XML DOM after loading it, but before using it as a
stylesheet (watch for performance hits though).

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two ways to generate RSS - rss/maker and rss/2.0 - which is better? Jonathan Groll Ruby 1 06-27-2009 03:53 AM
is RSS 2.0 still RSS 2.0 if we add our own unique tags to it? Jake Barnes XML 1 11-14-2005 01:54 AM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
RSS Feed - need an Idiot's Guide to RSS News on my website teach_me6@hotmail.com HTML 5 02-25-2005 11:01 AM
Searches in multiple RSS feeds -> new rss feed Motta XML 1 06-09-2004 10:55 PM



Advertisments