CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.dotnetnuke.getting_started Tags:
Item Type: NewsGroup Date Entered: 9/8/2005 3:26:24 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 0 Views: 66 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
coshi
Asp.Net User
Editing format of "pubDate" in News Feed RSS9/8/2005 3:26:24 PM

0/0

First, I'm a newbie to XSL transformations & RSS.
I'm displaying news using News Feed module and I need to display pubDate, but only date and nothing else.
What should I change?
Should I make some changes to RSS91.xsl or any changes in DotNetNuke.News project should be done?
iwonder
Asp.Net User
Re: Editing format of "pubDate" in News Feed RSS9/9/2005 7:31:03 PM

1/1

Welcome to the project.  I started looking at RSS a while back, and found loads of examples of xsl stylesheets, though it was more than a frustrating experience.  Now, for your problem at hand, yes, I'd start with modifying the existing xsl included, although, I'd recommend creating a new version and saving it, giving it a descriptive name.  Something like - rssJustpubDate.xsl.  Then, take your newsfeed module and use the new xsl to transform it.  For example, the default xsl does not include the pubDate element, because it is NOT part of the RSSv0.91 spec, so all you need to do is take out the pieces you don't want and put in the ones you want.  Of course, you must have a newsfeed that includes the pubDate, too!

Default DNN91.xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/><xsl:template match="rss">
  <!-- Do not show channel image -->
  <xsl:for-each select="channel/item">
    <br>
    <strong><a href="{link}" target="_main"><xsl:value-of select="title"/></a></strong><br></br>
    <!-- only display markup for description if it's present -->
    <xsl:value-of select="description"/>
    </br>
    <br></br>
  </xsl:for-each>
</xsl:template>
<xsl:template match="description">
  <br>
    <xsl:value-of select="."/>
  </br>
</xsl:template>
</xsl:stylesheet>

Modified rssJustpubDate.xsl

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
  <xsl:for-each select="channel/item">
  <div>  
    <strong><a href="{link}" target="_main"><xsl:value-of select="title"/></a></strong><br/>
      <xsl:value-of select="pubDate"/>
    </div>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

I used the above stylesheet with a Newsfeed module, using the RSS from these forums as a source.  It renders the Title (link) and the pubdate on the next line. This should give you a place to start...

News Feeds (RSS) Minimize

Install problem Security Issue???
Sat, 03 Sep 2005 13:49:14 GMT
Fresh Install Issue
Fri, 09 Sep 2005 11:41:36 GMT
ERRORS with fresh dnn 3.1.1 install
Fri, 09 Sep 2005 17:24:41 GMT


iwonder
Mission, KS - USA
iwonder
Asp.Net User
Re: Editing format of "pubDate" in News Feed RSS9/10/2005 12:38:09 AM

0/0

Ok, now that you've seen an example of how to display the elements you want, Title, and pubDate, how can you change the format of the pubDate to show only the date?  That's where learning more about xsl comes in to play.  There's no substitute for learning about specific functions from any one of the fine XML resources, you can uncover with a google search.  However, I'll show you 1 way to do it, and leave the rest for you to explore.

Here's a source RSS newsfeed:

<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="0.91">
  <channel>
     <title>HandCoded News</title>
     <link>http://www.hgworks.com/DesktopDefault.aspx?tabid=25</link>
     <description>HGWorks ...bringing the vision into focus.  Link for more info.</description>
     <language>en-us</language>
     <copyright>Copyright 2003-2004 HGWorks / Handcoded</copyright>
     <managingEditor>[email protected]</managingEditor>
     <webMaster>[email protected]</webMaster>
   <pubDate>Sat, 12 Mar 2005 20:21 GMT</pubDate>
   <lastBuildDate>Sat, 12 Mar 2005 20:21 GMT</lastBuildDate>
  <image>
 <title>Our Support Team</title>
 <url>http://www.hgworks.com/images/xml.gif</url>
 <link>http://hgworks.com/Portals/6b6e1a80-f39d-4ee0-b692-2d81ed9cfb26/hghcNews.xml</link>
 <width>32</width>
 <height>14</height>
 <description>Subscribe to our news feed by clicking this link button.  Copy the URL and insert into your favorite news feed reader.
(&#169; 2004 -
www.hgworks.com/handcoded)</description>
  </image>
<item>
 <title>Nukeleus - DNN Installer Beta</title>
      <pubDate>Sat, 12 Mar 2005 20:21 GMT</pubDate>
      <link>http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&amp;PostID=853647</link>
      <description>Check out this utility for installing DNN.  It's in beta, but it's going to make a lot of folks happy...
      </description>
</item>
<item>
 <title>DotNetNuke v3.x Released</title>
      <pubDate>Sat, 12 Mar 2005 20:21 GMT</pubDate>
      <link>http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&amp;PostID=855467</link>
      <description>DNNv3.x released. Check the official announcement for details...
      </description>
</item>
   </channel>
</rss>

And a sample xsl that transforms the feed using an xsl function to extract just the date portion of the item element's pubDate.  Just a matter of using the substring function, which is handy for limiting the number of characters to display for any string.  I mostly use it to limit the number of characters in a description element when I need to do that chore.  However, it works pretty cool for this solution, too.

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:template match="rss">
  <xsl:for-each select="channel/item">
  <div>  
    <strong><a href="{link}" target="_main"><xsl:value-of select="title"/></a></strong><br/>
      <xsl:value-of select="substring(pubDate,1,16)"/>
    </div>
 </xsl:for-each>
</xsl:template>
</xsl:stylesheet>

The output looks like this:

Nukeleus - DNN Installer Beta
Sat, 12 Mar 2005

DotNetNuke v3.x Released
Sat, 12 Mar 2005

The key to using xsl to transform newsfeeds is to inpect and understand the newsfeed source, then you can do most anything you want with it, transformation-wise that is. :)

One other tip to help you learn more about xml and xsl is to invest in a good xml editor, which will save you countless hours of frustration, because you can actually test and see what your code will look like against a source xml file, which is what RSS newsfeeds are anyway.

iwonder
Mission, KS - USA
coshi
Asp.Net User
Re: Editing format of "pubDate" in News Feed RSS9/13/2005 6:22:47 AM

0/0

Thanks for detailed answer Yes
So, I guess we can use any of the functions listed here http://www.devguru.com/Technologies/xslt/quickref/xslt_functions_xpath.html
+ 9 additional functions.
iwonder
Asp.Net User
Re: Editing format of "pubDate" in News Feed RSS9/13/2005 3:02:03 PM

0/0

Yes, that's a great link for info.  The functions should be useful, but the main thing is to test - test - test.  Browser implementation of xml support varies, and I find testing the xsl very beneficial.  Now, I illustrated methods from the standpoint of transforming the xml/rss feed element for pubDate, but there are ways to affect the actual creation of the rss feed, which is a core function.  I generally do not advocate making changes to Core functions, unless you absolutely have to do it, and then, you have to really be careful to plan the change, and keep track of the changes, so the next upgrade doesn't blow your work and site away


iwonder
Mission, KS - USA
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Syndicating Web Sites with RSS Feeds For Dummies Authors: Ellen Finkelstein, Chris Pirillo, Pages: 350, Published: 2005
Developing Feeds with RSS and Atom: [developer's guide to syndicating news and blogs] Authors: Ben Hammersley, Pages: 253, Published: 2005
Windows Vista Sidebar: Your Visual Blueprint for Developing Cool Gadgets for the Windows OS Authors: Dave Konopka, Pages: 320, Published: 2007
Professional SQL Server 2005 Integration Services Authors: Brian Knight, Allan Mitchell, Darren Green, Douglas Hinson, Kathi Kellenberger, Andy Leonard, Erik Veerman, Jason Gerard, Haidong Ji, Mike Murphy, Pages: 692, Published: 2006
Building Flickr Applications with PHP Authors: Rob Kunkle, Andrew Morton, Pages: 194, Published: 2006
The Internet: The Missing Manual Authors: David Pogue, J. D. Biersdorfer, Pages: 442, Published: 2006
RSS And Atom: Understanding And Implementing Content Feeds And Syndication Authors: Heinz Wittenbrink, Pages: 250, Published: 2005
Professional Web APIs with PHP: EBay, Google, PayPal, Amazon, FedEx, Plus Web Feeds Authors: Paul Michael Reinheimer, Pages: 356, Published: 2006
Essential Blogging: Selecting and Using Weblog Tools Authors: Cory Doctorow, Shelley Powers, Rael Dornfest, J. Scott Johnson, Benjamin Trott, Mena G. Trott, Pages: 244, Published: 2002
Beginning Expression Web Authors: Zak Ruvalcaba, Pages: 474, Published: 2007

Web:
RSS 2.0 Specification (RSS 2.0 at Harvard Law) This enables aggregators to not repeat items, even if there have been editing changes. If you have questions about the RSS 2.0 format, please post them on ...
RSS - Wikipedia, the free encyclopedia RSS 1.0 is an RDF format like RSS 0.90, but not fully compatible with it, ... [ edit] RSS 1.0. The following is an example of an RSS Feed 1.0 file (the ...
DotNetNuke: Setting up the RSS News Feed XSL Stylesheet,Tutorial In the module settings of the RSS News Feed Module, select Edit News Feed ... ( Replace "pubDate" with the TAG element you wish to display from the RSS feed) ...
RSS Feeds - Webcontent.gov - Guide to Managing U.S. Government ... How to use RSS feeds to deliver current news about your agency, and see what ... The only thing of specific note is the format for the element. ...
HOWTO: Create An RSS New Feed For Your Power Tab Related Web Site This article demonstrates how to create an RSS news feed for your Web site ... for your own feed, but ultimately the content and format is left up to you. ...
Basic Guide to Creating an Rss News Feed tells when your news feed was born (or re-born). The way the date is displayed is special, and the format must be followed down to the last comma ...
University Web Guide | Using RSS News Feeds on your website. Once everything in the inital setup is working you can edit the RSS file, ... link element or a valid date format in the PubDate element such as: Thursday, ...
Can I remove the time from pubDate? He meant that you cannot get rid of "pubDate: from your RSS feed, which I've come to realize that you aren't, you just want to format the ...
Low End Mac: Value Creating an RSS News Feed with PHP and MySQL</b></a> An RSS (Rich Site Summary) news feed is a text file that others can use to find out what's new on your website. There's a standard format for these ...<br /><a href="http://www.velocityreviews.com/forums/t117326-question-re-date-format-in-rss-news-feeds.html" title="question re: date format in RSS news feeds" target="_" ><b>question re: date format in RSS news feeds</b></a> Talk about question re: date format in RSS news feeds. ... converting the date format of "pubDate" into a datetime variable: ...<br /></div></td> <td valign="bottom"> <script type="text/javascript"> lqm_channel = 1; lqm_publisher = 303; lqm_zone = 1; lqm_format = 6; </script> <script type="text/javascript" src="http://a.lakequincy.com/s.js"></script> </td></tr></table> <br /> <table width="100%"> <tr> <td style="width: 50%"> </td> <td> </td> </tr> </table> <br /> <div style="text-align:center"> <br /> <br /> <b>Search This Site: </b> <input type="hidden" name="cx" value="001993386287184627138:djlrq6ok3yq" /> <input type="hidden" name="cof" value="FORID:10" /> <input type="text" name="q2" id="q2" size="25" onkeypress="if(event.keyCode == 13){SearchSite('q2');return false;}" value="" /> <input type="button" name="sa" value="Search" class="Button" onclick="SearchSite('q2');" /> </div> <br /> <script type="text/javascript"> function doSubscribe(S, E){ DoSubscribe(656128, S,E); } function doFavorite(S, E){ DoFavorite(656128, S,E); } </script> </td> <td id="rightPanel" valign="top" style="width: 100px; text-align: right;"> <div style="text-align: left; font-weight: bold; margin-left: 15px"><br /> <img src="http://www.codeverge.net/images/icons/envelope2.gif" /> <a rel="nofollow" onclick="OpenInviteWin();">Invite</a><br /> <img src="http://www.codeverge.net/images/icons/folders.gif" /> <a href="../History/history_items.aspx" id="ctl00_CPH_RightMenu_A2" rel="nofollow">History</a> <br /> <img src="http://www.codeverge.net/images/icons/books.gif" /> <a href="../resources/computers" id="ctl00_CPH_RightMenu_A1">Resources</a><br /> <img src="http://www.codeverge.net/images/icons/statements.gif" /> <a href="../sitemap/SiteMap.aspx" id="ctl00_CPH_RightMenu_A5" rel="nofollow">SiteMap</a> </div> <br /> <br /> <script type="text/javascript"> lqm_channel = 1; lqm_publisher = 303; lqm_zone = 1; lqm_format = 3; </script> <script type="text/javascript" src="http://a.lakequincy.com/s.js"></script> <br /><br /> <script type="text/javascript"> lqm_channel = 1; lqm_publisher = 303; lqm_zone = 1; lqm_format = 3; </script> <script type="text/javascript" src="http://a.lakequincy.com/s.js"></script> <br /><br /> <script type="text/javascript"> lqm_channel = 1; lqm_publisher = 303; lqm_zone = 1; lqm_format = 3; </script> <script type="text/javascript" src="http://a.lakequincy.com/s.js"></script> <br /><br /> <script type="text/javascript"> lqm_channel = 1; lqm_publisher = 303; lqm_zone = 1; lqm_format = 3; </script> <script type="text/javascript" src="http://a.lakequincy.com/s.js"></script> <div style="width: 100px; overflow: hidden; text-align: left; padding: 5px; font-family: Arial;"> <br /> <a href="http://www.codeverge.net/ng.asp-net-forum.visual_studio_2005/problem-publlish-project-and-include-xml-files" title="problem publlish project and include xml-files" ><b>problem publlish project and include xml-files</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.security/problems-with-security-using-aspnetdb" title="problems with security using aspnetdb" ><b>problems with security using aspnetdb</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.getting_started/2-web-services-questions-what-you-people-think" title="2 web services questions. what you people think ?" ><b>2 web services questions. what you people think ?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/creating-dnn-files" title="creating .dnn files" ><b>creating .dnn files</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/new-release-of-rewrite-module-for-dnn-4x" title="new release of rewrite module for dnn 4x" ><b>new release of rewrite module for dnn 4x</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/iframe-blocking-cookies-help" title="iframe blocking cookies, help!" ><b>iframe blocking cookies, help!</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.visual_studio_2005/deployment-scenario-after-publishing-a-website-in-visual-studio" title="deployment scenario after publishing a website in visual studio" ><b>deployment scenario after publishing a website in visual studio</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/user-online-module-problem" title="user online module problem" ><b>user online module problem</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.visual_web_developer_2005_express/design-or-developing" title="design or developing?" ><b>design or developing?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.security/web-user-presence" title="web user presence" ><b>web user presence</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.security/server2003-active-directory-iis6-asp.net-2.0-windows-authentication" title="server2003/active directory/iis6 asp.net 2.0 windows authentication" ><b>server2003/active directory/iis6 asp.net 2.0 windows authentication</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/how-does-the-scheduler-work" title="how does the scheduler work?" ><b>how does the scheduler work?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.getting_started/2-subs-accessing-code-from-each" title="2 subs - accessing code from each" ><b>2 subs - accessing code from each</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/skinning-with-3.0.12" title="skinning with 3.0.12" ><b>skinning with 3.0.12</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.commerce_starter_kit/why-two-databases" title="why two databases?" ><b>why two databases?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/paypal-and-dnn-3.0.13" title="paypal and dnn 3.0.13" ><b>paypal and dnn 3.0.13</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.getting_started/dataset-update" title="dataset update" ><b>dataset update</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/admin-and-host-tabs" title="admin and host tabs" ><b>admin and host tabs</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke/anyone-doing-any-podcasting-using-dnn" title="anyone doing any podcasting using dnn?" ><b>anyone doing any podcasting using dnn?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.internet_explorer_web_controls/newsboard-with-treeview" title="newsboard with treeview?" ><b>newsboard with treeview?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.getting_started/find-textboxes-in-a-aspx-page" title="find textboxes in a aspx page" ><b>find textboxes in a aspx page</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.dotnetnuke-custom_modules/is-there-a-file-download-module-for-dnn-3-4-asp-2.0" title="is there a file download module for dnn 3 / 4 asp 2.0??" ><b>is there a file download module for dnn 3 / 4 asp 2.0??</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.visual_studio_2008/how-to-run-view-project" title="how to run / view project" ><b>how to run / view project</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.security/profile-based-roles-possible" title="profile-based roles: possible?" ><b>profile-based roles: possible?</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.visual_web_developer_2005_express/error-when-trying-to-run-site" title="error when trying to run site" ><b>error when trying to run site</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.commerce_starter_kit/securing-login.aspx-page-as-ssl-page-forms-authentication-question" title="securing login.aspx page as ssl page / forms authentication question" ><b>securing login.aspx page as ssl page / forms authentication question</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.visual_studio_2005/order-of-layer-panel-not-working-in-vs-2005" title="order of layer (panel) not working in vs 2005" ><b>order of layer (panel) not working in vs 2005</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.windows-hosting_open_forum/my-containercontrol-reformats-the-inner-html.how-can-i-stop-it" title="my containercontrol reformats the inner html....how can i stop it.." ><b>my containercontrol reformats the inner html....how can i stop it..</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.microsoft_downloads-css_friendly_control_adapters/css-adapter-for-asp-menu" title="css adapter for asp menu" ><b>css adapter for asp menu</b></a><br/><br/><a href="http://www.codeverge.net/ng.asp-net-forum.internet_explorer_web_controls/treeview-frustrating-problem" title="treeview: frustrating problem" ><b>treeview: frustrating problem</b></a><br/><br/> </div> </td> </tr> <tr> <td id="leftBottom" valign="top" style="width: 100px">   </td> <td id="ctl00_centerBottom" valign="top" align="center"> <span id="ctl00_PageFooter1_lbl"></span> <br /> All Times Are GMT </td> <td id="rightBottom" valign="top" style="width: 100px"> </td> </tr> </table> <script type="text/javascript"> //<![CDATA[ var _Rating_MemberRating = -1; var _Rating_tbl = document.getElementById('ctl00_CPH_centerFront_ctl28'); function Rating_RollRates(){ if(_Rating_tbl.rows.length < 10){ for ( i =10 ; i >0; i--){ setTimeout( function(){ var row = _Rating_tbl.insertRow(_Rating_tbl.rows.length); var cell = row.insertCell(0); cell.onclick = function(){Rating_RateIt(this.innerHTML);}; cell.innerHTML = 12 - _Rating_tbl.rows.length; cell.className = 'Rating_AvgRating'; if(cell.innerHTML == _Rating_MemberRating){ cell.title='My Rating'; cell.style.color='orange'; } }, (10-i) * 25); } setTimeout(function(){Rating_Close()},10000) } else{ Rating_Close() } } function Rating_Close(){ if(_Rating_tbl.rows.length > 1) for ( i =0 ; i < 10; i++) setTimeout(function(){ _Rating_tbl.deleteRow(_Rating_tbl.rows.length -1 )} , i * 25) } function Rating_RateIt(rating){ ItemPageWs.RateItem(656128, rating, function(A){ document.getElementById('ctl00_CPH_centerFront_ctl29').innerHTML ='('+ parseFloat(A[0]).toFixed(2) +', '+ A[1] +')'; _Rating_MemberRating = rating; Rating_RollRates(); AlertMsg('Your Rating Was Updated'); Afirm( document.getElementById('ctl00_CPH_centerFront_ctl29')); }); } RestrictHeights('tcContent');Sys.Application.initialize(); //]]> </script> </form> </body> </html> <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_001993386287184627138%3Adjlrq6ok3yq&lang=en"></script> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script> <script type="text/javascript"> var pageTracker = _gat._getTracker("UA-3447589-1"); pageTracker._trackPageview(); </script>