implementing XSLT in rss feed

Discussion in 'Ruby' started by krishna.Mundra, Jan 30, 2007.

  1. 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>
     
    krishna.Mundra, Jan 30, 2007
    #1
    1. Advertising

  2. krishna.Mundra

    Zhe Lee Guest

    > 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/.
     
    Zhe Lee, Apr 6, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Roland Wolters

    RSS Feed

    Roland Wolters, Jul 27, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    506
    Roland Wolters
    Jul 27, 2003
  2. Replies:
    5
    Views:
    794
    SpaceGirl
    Feb 25, 2005
  3. Motta
    Replies:
    1
    Views:
    555
    Andy Dingley
    Jun 9, 2004
  4. Scott Gordo
    Replies:
    5
    Views:
    734
  5. Jonathan Groll
    Replies:
    1
    Views:
    294
    Kouhei Sutou
    Jun 27, 2009
Loading...

Share This Page