Trying to add a stylesheet to rss.xml feed. In node.module, i have the following code,

...
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
$output = "<?xml-stylesheet type=\"text\/css\" href="rss.css"?>\n";
...

rss.css is located in drupal root directory. i have added '\' to text/css to avoid parse error.
Still i am getting parse error here. What's wrong here ?

Comments

geohelper’s picture

PHP can get a little confused. Try this...

$output = "<" . "?xml version=\"1.0\" encoding=\"utf-8\"?" . ">\n";
$output = "<" . "?xml-stylesheet type=\"text\/css\" href="rss.css"? . ">\n";
Gunny-1’s picture

No, again parse same error.

The xml version line in the initial post is taken from node.module is syntatically correct. The error appeared when the xml-stylesheet got added. Simple syntax can sometimes drive you crazy.

geohelper’s picture

Not sure, but here is how Feedburner uses stylesheets...

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2enclosuresfull.xsl" type="text/xsl" media="screen"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?>
Gunny-1’s picture

fixed. it should look as given below,

$output .= "<?xml-stylesheet type=\"text/css\" href=\"rss.css\" ?>\n";