
![]() |
HomePage |
![]() |
JW Davidson |
![]() |
Show Changes |
![]() |
Edit |
![]() |
|
![]() |
Recent Changes |
![]() |
Subscriptions |
![]() |
Lost and Found |
![]() |
Find References |
| Local 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 |
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 load XML parameter (http://msdn.microsoft.com/rss.xml): Expected DTD markup was not found. Line 5, position 3.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() < 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>
--JoeGasper
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 "";
}
}
]]>

| Not logged in. | Log in | |
The wiki for all things Objective Design Solutions
| Recent Topics | |
![]() |
LiveRSSFeeds |
![]() |
List all versions |
![]() |
| Change Style |
| Powered by Flexwiki v2.0.0.218 |