PDA

View Full Version : Apply CSS to an Outside XML document?


SledgeHammer
2007-09-15, 11:06
The title basically says it. I am looking to apply my own style to an XML document generated elsewhere.

More specifically, I am putting together a web site for a friend who just opened a small antiques shop. For now, there will be no business done through the site, but she will be selling some things on eBay. eBay generates RSS feeds based on searches. What I would like to do is embed the feed for all auctions by this one user in the store's home page. In order for that to be useful, though, I need to apply style to it. I am planning to embed it in the page using the <iframe> tag, so my first thought was to have the frame load a page that called a style sheet, and then called the feed. The most straightforward solution seems to be the <object> tag, but I don't know that that will allow the CSS to affect the RSS document.

chucker
2007-09-15, 11:14
I don't think you'll be able to avoid post-processing the RSS feed on the server side, adding something like this to the second line:
<?xml-stylesheet type="text/css" href="screen.css"?>

So instead of this:
<?xml version="1.0"?>
<rss version="0.91" xmlns:xhtml="http://www.w3.org/1999/xhtml">

The document begins like this:
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="screen.css"?>
<rss version="0.91" xmlns:xhtml="http://www.w3.org/1999/xhtml">