views:

288

answers:

3

I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.

But I'm having trouble figuring out how to add a Processing Instruction to output that points to my CSS stylesheet.

What I need is a processing instruction that looks a bit like this:

<?xml-stylesheet type="text/css" href="http://you.com/rss.css" ?>

Anyone have a hint how you add that using SyndicationFeed ?

+1  A: 

I am not familiar with WCF, but I found this. I think this might help you out.

http://www.developmentnow.com/g/8_2008_2_0_0_1041398/xslt-and-System-ServiceModel-Syndication.htm

Brian Kim
+1  A: 

Since your contract is going to return an instance of SyndicationFeedFormatter, which implements IXmlSerializable, I would have your method on the service contract get that instance, then call the methods on IXmlSerializable to serialize the output to XML. You can then add the processing instruction to the XML (XDocument, or XmlDocument) and then pass those contents back.

casperOne