Welcome to WebmasterWorld Guest from

Forum Moderators: bill & werty

Message Too Old, No Replies

Styling with two stylesheets

XSL and CSS together?

9:53 pm on Mar 14, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 19, 2003
votes: 0

OK, I have recently set up an RSS feed, and the xml has the following line:

<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="newstyle.xsl"?>

So far, so good, I'm able to style it myself in terms of item sorting, link layout and bg colors when somebody browses the page directly. However, I would also like to link our CSS stylesheet to style the appearance of H1 and link hovers. But when I add a <link> in the XML to the CSS, nothing seems to happen (both normally and using the xml stylesheet format above). I then tried putting the <link> in the XSL <head>, but this didn't work either. No errors, just no styling.

I presume this must be possible, so am I doing something wrong?

Thanks for any help.

1:42 am on Mar 16, 2007 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
votes: 180

Something like this should work:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.example.com/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.example.com/itemcontent.css" type="text/css" media="screen"?>
10:14 am on Mar 16, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 19, 2003
votes: 0

Thanks for your input Bill.

In the end, I solved it myself - I was keen to link the stylesheet from the xsl rather than the xml, if possible, since I guess that should save bandwidth for me and the users because it will be called less often (ie in a dedicated newsreader it displays the feed in a different way).

Anyway, as far as I can tell, the problem was to do with case sensitivity differences between xml and css. When I changed my css to make it all lower case, it all worked. I had been using "A:hover" before, which was ok for html but not for this.