I have a Drupal 7 webiste. I want RSS feed from a few views in my Drupal webiste. I am able to get the feed but the .xml file has a lot of CSS styling in the description tag which is causing me some issues in the RSS reader. I want to get rid of the CSS styling in the description tag. Can anyone help ?


  • What do you mean by 'CSS styling'? Do you mean your body markup has inline styles? If so, you just need to create a new filter format, change it to plain text, and use that as the formatter for the description in the rss feed
    – Clive
    Commented May 6, 2014 at 14:55
  • By CSS Styling I mean CSS tags that are present inside the .XML file of the RSS feed . I want to get rid of all the CSS Styling that appears in the description tag. Commented May 6, 2014 at 14:58
  • Solution is the same - but why do you have <style> tags in a node body anyway?
    – Clive
    Commented May 6, 2014 at 15:00
  • I have no idea. When I had a look at the .xml file of my feed I could see the Styling in the description tag . I shall try your solution . Thank you verymuch Commented May 6, 2014 at 15:03

1 Answer 1


you can copy views-view-row-rss.tpl.php to your theme folder and then

<description><?php print $description; ?></description>

replace with

<description><?php print preg_replace("/<style\\b[^>]*>(.*?)<\\/style>/s", "", $description); ?></description>

it will remove css

if you also have inline styles then you need this

<?php $description = preg_replace('/(<[^>]+) style=".*?"/i', '$1',$description); ?>
<description><?php print preg_replace("/<style\\b[^>]*>(.*?)<\\/style>/s", "", $description); ?></description>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.