Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Ruby (http://www.velocityreviews.com/forums/f66-ruby.html)
-   -   implementing XSLT in rss feed (http://www.velocityreviews.com/forums/t837703-implementing-xslt-in-rss-feed.html)

krishna.Mundra 01-30-2007 07:37 AM

implementing XSLT in rss feed
 
HI ,

Can anyone help me in implementing rss feed with stylesheet of user's
choice....

xml.instruct! :xml, :version=>"1.0"
xml.foods{
for food in @foods
xml.food do
xml.id(food.id)
xml.calroies(food.calories)
xml.description(food.description)
xml.short_description(food.short_description)

for portion in food.portions
xml.portion do
xml.grams(portion.grams)
xml.amount(portion.amount)
xml.serving(portion.serving)
end
end
end
end
}

the above code generates rss like this
<?xml version="1.0" encoding="UTF-8" ?>
<foods>
<food>
<id>9193</id>
<calroies>115</calroies>
<description>Olives, ripe, canned (small-extra large)</description>
<short_description>Olives,Ripe,Cnd (Small-Extra
Lrg)</short_description>

<portion>
<grams>8.4</grams>
<amount>1.0</amount>
<serving>tbsp</serving>
</portion>

Zhe Lee 04-06-2007 06:11 AM

Re: implementing XSLT in rss feed
 
> but i want to include the root tag of XSL sheet in the generated rss
> <?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?>
>
> can anyone help me in this....



xml.instruct! 'xml-stylesheet', :type => "text/xsl", :href =>
"cdcatalog.xsl"


will work


zhelee

--
Posted via http://www.ruby-forum.com/.



All times are GMT. The time now is 06:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.