Filter RSS feed articles
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 3
- Joined: Fri Sep 28, 2007 1:43 am
Filter RSS feed articles
Ok, this may become confusing because I don't really understand what I'm
doing, but here goes.
I what to add some news from a related site that uses RSS to push news. The
feed actually has 16 records/articles, (two months worth). The space I can
put this in on my site can accomidate about 5 or 6 records/articles. I've
got the feed set up on a test page and see all 16 records. When I use the
Data View Preview to limit the number of records to 5, the test page shows
only 5 records, however when I insert the test page (as an include) into the
area of my site where it will disply the news it defaults to all 16 records.
The news feed produces about 5 articles a month, so is there a way to filter
out articles older than the current month?
Some one else told me that I might be able to use XPATH to do this but I don't know anything about this so some help would be appreciated.
doing, but here goes.
I what to add some news from a related site that uses RSS to push news. The
feed actually has 16 records/articles, (two months worth). The space I can
put this in on my site can accomidate about 5 or 6 records/articles. I've
got the feed set up on a test page and see all 16 records. When I use the
Data View Preview to limit the number of records to 5, the test page shows
only 5 records, however when I insert the test page (as an include) into the
area of my site where it will disply the news it defaults to all 16 records.
The news feed produces about 5 articles a month, so is there a way to filter
out articles older than the current month?
Some one else told me that I might be able to use XPATH to do this but I don't know anything about this so some help would be appreciated.
-
- Posts: 89
- Joined: Mon Mar 06, 2006 10:13 pm
You could always copy just the nodes from the first 5 articles, using XSLT and xpath
If you want date filtering, you'd need a node in the rss feed that specifies when each article has been published.
If you could post part of the feed, or the link to it, it'd be easier to create a custom XSLT for you.
If you want date filtering, you'd need a node in the rss feed that specifies when each article has been published.
If you could post part of the feed, or the link to it, it'd be easier to create a custom XSLT for you.
-
- Posts: 3
- Joined: Fri Sep 28, 2007 1:43 am
Thanks for your reply and for your help. The link is http://community.kiwanisone.org/blogs/k ... s/rss.aspxjkmyoung wrote:You could always copy just the nodes from the first 5 articles, using XSLT and xpath
If you want date filtering, you'd need a node in the rss feed that specifies when each article has been published.
If you could post part of the feed, or the link to it, it'd be easier to create a custom XSLT for you.
So if using the current date, all articles older than say 35 day's would not be posted. Hopefully that way the displayed feed would not grow larger than 5 or 6 articles.
I found a free tool online to do this at RSS Feed Reader however, free is not really free when you have to deal with Adware. Plus, if their server goes offline - no feed.
-
- Posts: 89
- Joined: Mon Mar 06, 2006 10:13 pm
You could actually use their own XSLT at http://community.kiwanisone.org/utility ... ts/rss.xsl
Just make modifications to add filters. You can also remove their header text if you want. Assuming there is only one channel, the line to change is here:
<xsl:for-each select="rss/channel/item">
For the first 5, change it to:
<xsl:for-each select="rss/channel/item[position() < 6]">
If you want to actually filter on date, you'd use the pubdate element, eg:
<pubDate>Thu, 23 Aug 2007 20:50:00 GMT</pubDate>
To be honest, doing it this way is a lot harder since the date uses Strings instead of numbers for the month, further, you would have to pass in the current date as a parameter into the xslt, more complications.
Just make modifications to add filters. You can also remove their header text if you want. Assuming there is only one channel, the line to change is here:
<xsl:for-each select="rss/channel/item">
For the first 5, change it to:
<xsl:for-each select="rss/channel/item[position() < 6]">
If you want to actually filter on date, you'd use the pubdate element, eg:
<pubDate>Thu, 23 Aug 2007 20:50:00 GMT</pubDate>
To be honest, doing it this way is a lot harder since the date uses Strings instead of numbers for the month, further, you would have to pass in the current date as a parameter into the xslt, more complications.
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service