Thanks for your followup.
>From: =?Utf-8?B?UGF1bA==?= <vis@nospam.nospam>
>Subject: RE: xslt and System.ServiceModel.Syndication
>Date: Mon, 11 Feb 2008 02:53:03 -0800
>
>Hi guys,
>
>Thanks for the input. My problems were in the underlying memory streams,
>sorry but I can't recall the detail now.
>
>Here is the final method I used to emit from my aspx page:
>
> Private Sub WriteOutput()
> Dim feed As SyndicationFeed = New SyndicationFeed
> feed = GetARSFeed()
> 'feed = getDummyFeed()
>
> Dim Title As TextSyndicationContent = New
>TextSyndicationContent(_FeedInfo.FeedName)
> Dim Description As TextSyndicationContent = New
>TextSyndicationContent(_FeedInfo.FeedDescription)
> feed.Title = Title
> feed.Description = Description
>
> Select Case _FeedInfo.OutputFormat
> Case "Raw RSS"
> Dim memstream As New MemoryStream
> Dim rssWriter As XmlWriter = XmlWriter.Create(memstream)
> Dim rssFormatter As Rss20FeedFormatter = New
>Rss20FeedFormatter(feed)
> rssFormatter.WriteTo(rssWriter)
>
> rssWriter.Flush()
>
> memstream.Seek(0, SeekOrigin.Begin)
> Dim xslReader As XmlReader = XmlReader.Create(memstream)
>
> Response.ContentType = "text/xml"
> Dim r As New StreamReader(memstream)
> memstream.Seek(0, SeekOrigin.Begin)
> Response.Write(r.ReadToEnd)
> Response.End()
> Case "Raw ATOM"
> Dim memstream As New MemoryStream
> Dim rssWriter As XmlWriter = XmlWriter.Create(memstream)
> Dim atomFormatter As Atom10FeedFormatter = New
>Atom10FeedFormatter(feed)
> atomFormatter.WriteTo(rssWriter)
>
> rssWriter.Flush()
>
> memstream.Seek(0, SeekOrigin.Begin)
> Dim xslReader As XmlReader = XmlReader.Create(memstream)
>
> Response.ContentType = "text/xml"
> Dim r As New StreamReader(memstream)
> memstream.Seek(0, SeekOrigin.Begin)
> Response.Write(r.ReadToEnd)
> Response.End()
> Case "RSS Presented as Formatted HTTP"
> Dim memstream As New MemoryStream
> Dim rssWriter As XmlWriter = XmlWriter.Create(memstream)
> Dim rssFormatter As Rss20FeedFormatter = New
>Rss20FeedFormatter(feed)
> rssFormatter.WriteTo(rssWriter)
>
> rssWriter.Flush()
>
> Dim xslt As New Xsl.XslCompiledTransform()
> xslt.Load(_FeedInfo.XSLTFileName)
>
> memstream.Seek(0, SeekOrigin.Begin)
> Dim xslReader As XmlReader = XmlReader.Create(memstream)
>
> Dim newmem As New MemoryStream
> xslt.Transform(xslReader, Nothing, newmem)
>
> Response.ContentType = "text/HTML"
> Dim r As New StreamReader(newmem)
> newmem.Seek(0, SeekOrigin.Begin)
> Response.Write(r.ReadToEnd)
> Response.End()
> End Select
>
>
>
>"Steven Cheng[MSFT]" wrote:
>
>> Thanks for your reply Paul,
>>
>> Regarding on the new error message you mentioned, there seems exist some
>> certain character that make the XSLT transformor complain about. I
suggest
>> you first save the RSS XML document(get from the Syndication object)
into a
>> xml file and then open it in IE to see whether IE will detect any
well-form
>> validation error. You can also try using a simple RSS collection so that
>> you can also open the saved XML document and check it in some text
editor.
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
>>
>>
>>
>> --------------------
>> >Thread-Topic: xslt and System.ServiceModel.Syndication
>> >thread-index: Achn8QRDXF8dmdNBRpuVMxLsXmxj0A==
>> >Subject: RE: xslt and System.ServiceModel.Syndication
>> >Date: Tue, 5 Feb 2008 04:17:03 -0800
>>
>> >Steven,
>> >
>> >Thanks for your input. I have tried your approach, and find that I get
>> >errors on the transform. I have tried with various data sources, like
the
>> >names of folders in my music collecection etc. I get errors like:
>> >
>> >"'<', hexadecimal value 0x3C, is an invalid attribute character. Line
1,
>> >position ..."
>> >or
>> >"There is an unclosed literal string ...
>> >
>> >How do I deal with these errors without cancelling the whole transform?
>> >
>> >Thanks
>> >Paul
>> >
>> >"Steven Cheng[MSFT]" wrote:
>> >
>> >> Hi Paul,
>> >>
>> >> As for the rss transforming issue, I think you may consider the
>> following
>> >> approach:
>> >>
>> >> Since you originally write the Syndication object into XMLWriter and
>> flush
>> >> out to ASP.NET page response, you can consider first write the RSS
xml
>> into
>> >> a memoryStream(wrappered through a XmlWriter). Then, you can use .NET
>> XSLT
>> >> api to perform tranformation on the XML document in the
>> memorystream(read
>> >> it through a StreamReader).
>> >>
>> >> Here are some information about how to use XSLT transformation
classes
>> in
>> >> .NET 2.0:
>> >>
>> >> #XSLT Transformations
>> >>
http://msdn2.microsoft.com/en-us/library/14689742.aspx >> >>
>> >> #XSL Transformations in .NET 2.0
>> >>
http://www.15seconds.com/issue/060608.htm >> >>
>> >> Hope this helps.
>> >>
>> >> Sincerely,
>> >>
>> >> Steven Cheng
>> >>
>> >> Microsoft MSDN Online Support Lead
>> >>
>> >>
>> >>
>> >> ==================================================
>> >>
>> >> Get notification to my posts through email? Please refer to
>> >>
>>
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif >> >> ications.
>> >>
>> >>
>> >>
>> >> Note: The MSDN Managed Newsgroup support offering is for non-urgent
>> issues
>> >> where an initial response from the community or a Microsoft Support
>> >> Engineer within 1 business day is acceptable. Please note that each
>> follow
>> >> up response may take approximately 2 business days as the support
>> >> professional working with you may need further investigation to reach
>> the
>> >> most efficient resolution. The offering is not appropriate for
>> situations