Show Changes Show Changes
Print Print
Recent Changes Recent Changes
Subscriptions Subscriptions
Lost and Found Lost and Found
Find References Find References
Rename Rename
Administration Page Administration Page
Search

History

9/19/2007 2:17:18 PM
-74.15.253.157
9/19/2007 2:08:29 PM
-74.15.253.157
List all versions List all versions

RSS feed for the TestJwd namespace

Related Topics

Live RSS Feeds
.
Summary

By using the XmlTransform WikiTalk behavior, you can get the content from an RSS feed, run it through a transform that generates Wiki text and the results will be dynamically displayed.

For example, here are the latest headlines from DavidOrnstein's blog:

Failed to Transform Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at http://www.flexwiki.com/xslt/rssToWikiList.xslt(31,70).

This is achieved by running an XSLT transform on the feed.

Right now, the XSLT is coming from a friendly site ().

Soon, it will be possible to just type the XSLT inline (or place it in a Wiki topic).

--DavidOrnstein

Here's the XSLT source for the transform used above:

 <?xml version="1.0" encoding="UTF-8" ?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:cs="urn:cs"
 >
 <xsl:output method="text" />
 <msxsl:script language="c#" implements-prefix="cs">
 <![CDATA[
        public string ToLocalTime(string pubDate)
        {
                DateTime t = DateTime.Parse(pubDate);
                DateTime l = t.ToLocalTime();
                return t.ToString("yyyy/M/d(ddd) tt h:mm");
        }
 ]]>
 </msxsl:script>
 <xsl:template match="/"> 
         <xsl:for-each select="rss/channel/item">
        <xsl:if test="position() < 5">
 *"<xsl:value-of select="title"/>":<xsl:value-of select="guid"/> <xsl:value-of select="cs:ToLocalTime  (pubDate)" /></xsl:if>
          </xsl:for-each>
 </xsl:template></xsl:stylesheet>

I've modified the rssToWikiLink.xslt to create links to the RSS feed items. Here's an example to the MSDN Just Published feed:

Failed to Transform Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at http://gasper.org/rssToWikiLinkedList.xslt(51,94).

The modified XSLT file (rssToWikiLinkedList.xslt) (please use and load this file locally...):

<?xml version="1.0" encoding="UTF-8" ?>
<!-- 
#region License Statement
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// The use and distribution terms for this software are covered by the 
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by 
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.
#endregion
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
        xmlns:cs="urn:cs">
        <xsl:output method="text" />
        <msxsl:script language="c#" implements-prefix="cs">
<![CDATA[
        public string ToLocalTime(string pubDate)
        {
                DateTime t = DateTime.Parse(pubDate);
                DateTime l = t.ToLocalTime();
                return t.ToString("yyyy/M/d(ddd) tt h:mm");
        }
]]>
</msxsl:script>
        <xsl:template match="/">
                <xsl:for-each select="rss/channel">
!!!@@Presentations.Link("<xsl:value-of select="link" />", "<xsl:value-of select="title" />", "<xsl:value-of select="description" />")@@
                </xsl:for-each>
                <xsl:for-each select="rss/channel/item">
                        <xsl:if test="position() &lt; 8">
        *@@Presentations.Link("<xsl:value-of select="link" />", "<xsl:value-of select="title" />", "<xsl:value-of select="cs:ToLocalTime(pubDate)" />")@@
                        </xsl:if>
                </xsl:for-each>
        </xsl:template>
</xsl:stylesheet>
Note
In order for XmlTransform to work on my IIS installation, the security group ISS_WPG had to have modify rights to the system's TEMP location (i.e., c:\temp).

--JoeGasper

Note
Note

Limitations

Error

Quick Temporary Workaround suggested by JoeGasper:

<![CDATA[
        public string ToLocalTime(string pubDate)
        {
                try
                {
                        pubDate = pubDate.Trim();
                        string tz = pubDate.SubstringpubDate.LastIndexOf(" ")).ToUpper().Trim();
                        if ( tz == "GMT" )
                        {
                                DateTime t = DateTime.Parse(pubDate).ToLocalTime();
                                return t.ToString("yyyy/M/d (ddd) h:mm tt");
                        }
                        else
                        {
                                pubDate = pubDate.Substring(0,16);
                                DateTime t = DateTime.Parse(pubDate).ToLocalTime();
                                return t.ToString("yyyy/M/d (ddd)");
                        }
                }
                catch ( Exception ex )
                {
                        return "";
                }
        }
]]>
Error
Error

Examples

Failed to Transform Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at http://gasper.org/rssToWikiLinkedList.xslt(51,94). Failed to Transform Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at http://gasper.org/rssToWikiLinkedList.xslt(51,94). Failed to Transform Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at http://gasper.org/rssToWikiLinkedList.xslt(51,94). Failed to Transform Execution of scripts was prohibited. Use the XsltSettings.EnableScript property to enable it. An error occurred at http://gasper.org/rssToWikiLinkedList.xslt(51,94).

Not logged in. Log in

The wiki for all things Objective Design Solutions

This is FlexWiki, an open source wiki engine.

This site supports the new NoFollow anti-spam initiative.
Change Style

Recent Topics