xml.instruct! 'xml-stylesheet', :href=>'/stylesheets/atom.css', :type=>'text/css'

xml.feed :xmlns=>'http://www.w3.org/2005/Atom' do
  xml.div :xmlns=>'http://www.w3.org/1999/xhtml', :class=>'info' do
   xml << <<-EOF
     This is an Atom formatted XML site feed.
     It is intended to be viewed in a Newsreader or syndicated to another site.
     Please visit <a href="http://www.atomenabled.org/">atomenabled.org</a> for more info.
   EOF
  end

  xml.title   'Sam Ruby'
  xml.link    :rel=>'self', 
    :href=>url_for(:only_path=>false, :action=>'posts', :path=>['index.atom'])
  xml.link    :href=>url_for(:action=>'posts', :path=>nil)
  xml.id      :href=>url_for(:only_path=>false, :action=>'posts', :path=>nil)
  xml.updated Time.now.iso8601
  xml.author  { xml.name 'Sam Ruby' }

  @entries.unshift @parent if @parent
  @entries.each do |entry|
    xml.entry do
      xml.title   entry.title
      xml.link    :href=>url_for(entry.by_date)
      xml.id      entry.atomid
      xml.updated entry.updated.iso8601
      xml.author  { xml.name entry.author.name } if entry.author
      xml.summary do
        xml.div :xmlns=>'http://www.w3.org/1999/xhtml' do
          xml << entry.summary
        end
      end if entry.summary
      xml.content do
        xml.div :xmlns=>'http://www.w3.org/1999/xhtml' do
          xml << entry.content
        end
      end
    end
  end

end
