Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsSimple XSL Customization HelpSimple XSL Customization Help
Previous
 
Next
New Post
2/22/2008 12:41 PM
 

Hello guys i am using News Module to display Google News Feed.  Unfortunately i have few problems that i would like to get your help ;)

First of all Google News feed displays encoded characters in Titles (e.g > Castro 'relishes chance to rest' - BBC News) As you see this is unwanted situation if you want to show a feed on your website.

My question is can we eleminate or convert this encoded sections to correct titles? If so how we could customize our xsl template.

 

Also my feed has duplicate titles. I'm going to attach my XSL file here and would like to get your assistance about how to fix these issues.

I checked orginal feed page ( click on this link) and noticed that they are presenting titles twice and i only want to display title once. Please help me.

Thanks in advance.

 

Here is my xsl file;

<?xml version="1.0" encoding="UTF-8"?>
<!-- Example by Phil 'iwonder' Guerra -->
<!-- Edited by Lee Sykes DNN Creative Magazine http://www.dnncreative.com -->
<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 -->
  <!-- Do not select the first item (this is useful if there are advertisements, such as using an RSS feed from moreover.com-->
  <xsl:for-each select="channel/item[position() &gt; 0]">
 
    <!-- Test to limit number of items displayed.  Here only 5 items will be transformed -->
  <xsl:if test="position() &lt; 6">

    <br></br>
    <!-- to open links in a new window, change target="_main" to target="_blank" -->
    <strong><a href="{link}" target="_blank"><xsl:value-of select="title"/></a></strong>
    <br>
        <!-- <xsl:value-of select="pubDate"/> -->
    </br>
    <!-- only display 100 characters of the description, and allow html -->
    <xsl:value-of disable-output-escaping="yes" select="description"/>
    <br></br>
  </xsl:if>
  </xsl:for-each>
 
</xsl:template>


<xsl:template match="description">
  <br>
    <xsl:value-of select="."/>
  </br>
</xsl:template>
  <xsl:template name="strip-tags">
    <xsl:param name="text"/>
    <xsl:choose>
      <xsl:when test="contains($text, '&lt;')">
        <xsl:value-of select="substring-before($text, '&lt;')" />
        <xsl:call-template name="strip-tags">
          <xsl:with-param name="text" select="substring-after($text, '&gt;')"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="substring($text, 1, 100)" />
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>

 


Or-Rouge Team Or-Rouge
Personally recommend Hostgator for hosting single or multiple DotNetNuke Websites.
DotNetNuke Tips and Tutorials
Install DotNetNuke to Godaddy root
DotNetNuke Türkçe Hakkinda Hersey
 
New Post
3/2/2008 9:12 AM
 

Well, I'm going to go over this one.  The example feed from Google illustrates what can be done by a feed source to really screw up a newsfeed.  In the early days, RSS specs didn't really disallow HTML markup, but there was a general concensus to seperate markup from the feed.  We used css stylesheets to provide - gee uh, styling.  Seemed pretty reasonable to me and a lot of other folks.  Then, the little RSS feed evolved into the hairy beast that google provides. 

There is so much going on with this feed, I'd really not even fuss with using it or customize it.  I wouldn't want to encourage folks to even go to Google for news.  That's just my opinion, but there are other sources that have newsfeeds which are easier to work into your site.  Of course, that doesn't help you, so, I'll discuss what can be done, but it's not simple by any means.

In any event, when you want to effectively 'control' the feed with a custom xsl, it helps to have your programming cap on, and a good xml/xsl editor.  Afterall, a newsfeed is all code that has to be broken down and evaluated.  So, the first step is to use your browser to view the source, and I usually borrow it - placing into whatever tool you can use for further evaluation.

Let's take your problem with the feed showing the title twice.  Looking at the sourcefeed, we find that this is caused by the inclusion of the 'title' information in the DESCRIPTION tag.  The TITLE tag has the 'title' and 'news source attribution' combined, and that is followd up by placing the same info into the DESCRIPTION tag with a bit of variance in the style.  You could probably program around the issue by creating vars to hold the title info and strip the same info out of the DESCRIPTION, but the different styling would create another programming block.  So, my recommendation is to just forget about showing the TITLE tag altogether.  I don't like to do a whole lot of custom programming to fuss with these types of horror-show news sources, so I take a simple approach.  See, the newsource is probably going to change their formatting, and when they do, you have to change all of your programming again and again.

Now, the other part of your question is how to eliminate the HTML encoding.  That's seems easy to do, but in certain cases, it is difficult due to the mish-mash of css and html included.  All you really do with the not coding the HTML is present the info without using it to control the output.  You will get the various lt gt tags and every other bit of HTML in the tag presented.  So, again, it's a lot of customizing to deal with the issue, and hope that the source doesn't change - but I promise you that will not happen.  I've done so many different google xsl's, I just don't use them anymore, unless I want to just present what they do - and that's just plain ugly.

So, back to the issue... You provide an example xsl that I'll need to take, and examine on my dev site, but it may take some time for me to get back to you.  Lee and I worked several examples, and it looks like you put some of them together, but with this example sourcefeed, there may be some other issues going on that make it not the best to use in your case.  So, be patient, or take my other advice, and look for a different news source or just present it as is.

I'll get back to you, but I'm in the middle of converting our Hospital clinical system from backend servers using OpenVMS to HP-UX, so I'm really engaged in all things UNIX / Linux / Korn Shell / Perl / Python and whatnot.  Pretty ugly stuff on its' own.

Cheers,

 

 
New Post
3/14/2008 6:02 PM
 

First of all, i would like to thank you for this long and descriptive reply.

Let me know if you'll have the solution. Btw - i m able to remove duplicate titles, but this time title link won't open in blank window lol


Or-Rouge Team Or-Rouge
Personally recommend Hostgator for hosting single or multiple DotNetNuke Websites.
DotNetNuke Tips and Tutorials
Install DotNetNuke to Godaddy root
DotNetNuke Türkçe Hakkinda Hersey
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsNews FeedsNews FeedsSimple XSL Customization HelpSimple XSL Customization Help


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out