About

I'm Mike Pope. I live in the Seattle area. I've been a technical writer and editor for over 35 years. I'm interested in software, language, music, movies, books, motorcycles, travel, and ... well, lots of stuff.

Read more ...

Blog Search


(Supports AND)

Feed

Subscribe to the RSS feed for this blog.

See this post for info on full versus truncated feeds.

Quote

One of the things that draws writers to writing is that they can get things right that they got wrong in real life by writing about them.

— Tobias Wolff



Navigation





<April 2025>
SMTWTFS
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

Categories

  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  
  RSS  

Contact Me

Email me

Blog Statistics

Dates
First entry - 6/27/2003
Most recent entry - 4/17/2025

Totals
Posts - 2657
Comments - 2678
Hits - 2,737,678

Averages
Entries/day - 0.33
Comments/entry - 1.01
Hits/day - 344

Updated every 30 minutes. Last: 10:26 AM Pacific


  01:26 AM

I was perusing a back issue of Gunderloy's Daily Grind and found an article by Peter Freitag about a neat idea -- applying a CSS style sheet to your RSS feed. Raw RSS feeds look all XML-ish in the browser, but you can link the feed to a style sheet and then it can look nice(r). All you need to do is add a line like this:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="http://you.com/rss.css" ?>
<rss>
...
</rss>
(Well, and there is the small matter of creating the style sheet -- Freitag illustrates that, too.)

This sounded like fun. I added one to my comments feed (example), which was easy, because I keep the feed's XML skeleton in a text file, as described before.[1]

I then turned my attention to the main feed. I implemented that way back when as a Web service (.asmx).[2] I read a skeleton for that, too, and then fill in the <rss> element and children with a bunch of tedious XmlElement-ing.

But I could not get the feed to include the style sheet link. I checked that the skeleton was indeed being read from the file, as expected, but somehow the <?xml-stylesheet ?> element was just never getting in there.

It took me some time to realize that my skeletal <?xml version="1.0" ?> element wasn't getting in there, either. The element was showing up -- or a version of the element was -- but it wasn't being put there by me. Hmmm. Hmmm.

Aha. I figured out that although I was supplying the <rss> guts, the whole XML stream was actually, really being produced by the Web service. As in, the stream being sent to the browser was all the result of SOAP magic, and in the transformation to and from SOAP, the Web service paid no nevermind to anything outside the actual <rss> content I was sending.

Slightly to my surprise, I found an article by "cmumford" on CodeProject.com that explained this and illustrated the solution. As he says: "Unfortunately, this involves serializing the object to a stream, deserializing it into a XmlDocument, and then reserializing it after first attaching the processing directive."

Oh. Well, that's not going to happen. So one of these days, in my copious spare time, I guess I'll rewrite the main feed to be a handler instead of a Web service, which will give me direct control over what gets sent down the wire. And when I get around to that, keep your eye out for a much prettier feed.


[1] Naturally -- oh, how so very surprising -- IE and Firefox differ in support for applying CSS to XML tags with namespaces e.g. <dc:creator>. Firefox supports the proposed new syntax; IE6 does not. (AFAIK) Firefox will in fact ignore the namespace if you don't provide a URL and will apply CSS rules to tags as if they didn't have a namespace. I haven't tested any of this on IE7.

[2] Which I'll blame on Chris Anderson, whose BlogX I used as my very first model for creating this blog. :-)

[categories]   ,

|