### Eclipse Workspace Patch 1.0
#P django-trunk
Index: django/utils/feedgenerator.py
===================================================================
--- django/utils/feedgenerator.py	(revision 13418)
+++ django/utils/feedgenerator.py	(working copy)
@@ -71,13 +71,15 @@
     "Base class for all syndication feeds. Subclasses should provide write()"
     def __init__(self, title, link, description, language=None, author_email=None,
             author_name=None, author_link=None, subtitle=None, categories=None,
-            feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, **kwargs):
+            feed_url=None, feed_copyright=None, feed_guid=None, ttl=None, stylesheets=None, **kwargs):
         to_unicode = lambda s: force_unicode(s, strings_only=True)
         if categories:
             categories = [force_unicode(c) for c in categories]
         if ttl is not None:
             # Force ints to unicode
             ttl = force_unicode(ttl)
+        if stylesheets:
+            stylesheets = [iri_to_uri(s) for s in stylesheets]
         self.feed = {
             'title': to_unicode(title),
             'link': iri_to_uri(link),
@@ -92,6 +94,7 @@
             'feed_copyright': to_unicode(feed_copyright),
             'id': feed_guid or link,
             'ttl': ttl,
+            'stylesheets': stylesheets or (),
         }
         self.feed.update(kwargs)
         self.items = []
@@ -198,6 +201,8 @@
     def write(self, outfile, encoding):
         handler = SimplerXMLGenerator(outfile, encoding)
         handler.startDocument()
+        for s in self.feed['stylesheets']:
+            handler.processingInstruction('xml-stylesheet', 'type="text/css" href="%s"' % s) # http://www.w3.org/TR/xml-stylesheet/
         handler.startElement(u"rss", self.rss_attributes())
         handler.startElement(u"channel", self.root_attributes())
         self.add_root_elements(handler)
Index: docs/ref/contrib/syndication.txt
===================================================================
--- docs/ref/contrib/syndication.txt	(revision 13418)
+++ docs/ref/contrib/syndication.txt	(working copy)
@@ -286,6 +286,12 @@
 location. The syndication framework populates this automatically, using the
 domain of the current site according to the :setting:`SITE_ID` setting.
 
+Stylesheets
+-----------
+
+RSS feeds support the inclusion of stylesheets via the :attr:`stylesheets`
+attribute, as a sequence of stylesheets to be added to the feed.
+
 Publishing Atom and RSS feeds in tandem
 ---------------------------------------
 
@@ -532,6 +538,8 @@
             """
 
         ttl = 600 # Hard-coded Time To Live.
+        
+        stylesheets = ('http://www.example.com/example.css',) # Hard-coded stylesheets to be added to feed
 
         # ITEMS -- One of the following three is required. The framework looks
         # for them in this order.
@@ -820,11 +828,12 @@
         * ``feed_copyright``
         * ``feed_guid``
         * ``ttl``
+        * ``stylesheets``
 
     Any extra keyword arguments you pass to ``__init__`` will be stored in
     ``self.feed`` for use with `custom feed generators`_.
 
-    All parameters should be Unicode objects, except ``categories``, which
+    All parameters should be Unicode objects, except ``categories`` and ``stylesheets``, which
     should be a sequence of Unicode objects.
 
 .. method:: SyndicationFeed.add_item(**kwargs)
Index: tests/regressiontests/syndication/tests.py
===================================================================
--- tests/regressiontests/syndication/tests.py	(revision 13418)
+++ tests/regressiontests/syndication/tests.py	(working copy)
@@ -50,7 +50,11 @@
         self.assertEqual(len(feed_elem), 1)
         feed = feed_elem[0]
         self.assertEqual(feed.getAttribute('version'), '2.0')
-
+        
+        # Verify document has a stylesheet element (processing instruction <?xml-stylesheet ... ?>)
+        self.assertEqual(doc.firstChild.target, 'xml-stylesheet')
+        self.assertEqual(doc.firstChild.data, 'type="text/css" href="http://www.example.com/example.css"')
+        
         # Making sure there's only one `channel` element w/in the
         # `rss` element.
         chan_elem = feed.getElementsByTagName('channel')
Index: django/contrib/syndication/views.py
===================================================================
--- django/contrib/syndication/views.py	(revision 13418)
+++ django/contrib/syndication/views.py	(working copy)
@@ -114,6 +114,7 @@
             feed_copyright = self.__get_dynamic_attr('feed_copyright', obj),
             feed_guid = self.__get_dynamic_attr('feed_guid', obj),
             ttl = self.__get_dynamic_attr('ttl', obj),
+            stylesheets = self.__get_dynamic_attr('stylesheets', obj),
             **self.feed_extra_kwargs(obj)
         )
 
Index: tests/regressiontests/syndication/feeds.py
===================================================================
--- tests/regressiontests/syndication/feeds.py	(revision 13418)
+++ tests/regressiontests/syndication/feeds.py	(working copy)
@@ -22,7 +22,8 @@
     categories = ('python', 'django')
     feed_copyright = 'Copyright (c) 2007, Sally Smith'
     ttl = 600
-
+    stylesheets = ('http://www.example.com/example.css',)    
+    
     def items(self):
         return Entry.objects.all()
 
