|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Xsl transform of rss feed help please
greetings, Long time reader, First time writer!
My question is this; I have a rss news feed up and running on a website, but I would like to sift through the 30-40 items provided and display only the ones with a certian word in the title. For example in the following snippet of an rss feed I would like to display only the 2nd and 3rd items because they contain the word "Bush" in the title(sort of a regex type of search). Any ideas on how to do this? ~~snip~~~ - <item> <title>Judge Dismisses Charges Against Woman Who Killed Her Unborn Child</title> - <link> - <![CDATA[ http://abcnews.go.com/US/LegalCenter/story?id=2585102&page=1&CMP=OTC-RSSFeeds0312 ]]> </link> <pubDate>Thu, 19 Oct 2006 14:59:46 -0400</pubDate> <description>Pregnant Mother Shot Herself in the Stomach, Killing Her Child, Va. Judge Rules Causing Your Own Abortion Is Not a Crime</description> </item> - <item> <title>Bush Accepts Iraq-Vietnam Comparison</title> - <link> - <![CDATA[ http://abcnews.go.com/WNT/story?id=2583579&CMP=OTC-RSSFeeds0312 ]]> </link> <pubDate>Thu, 19 Oct 2006 09:12:02 -0400</pubDate> <description>George Stephanopoulos Interviews President Bush on Iraq, the Midterms and His Legacy</description> </item> - <item> <title>George Bush's head Caves In During News Conference</title> - <link> - <![CDATA[ http://abcnews.go.com/WNT/story?id=2583579&CMP=OTC-RSSFeeds0312 ]]> </link> <pubDate>Thu, 19 Oct 2006 09:12:02 -0400</pubDate> <description>George Carlin in Hospital After Laughing Fit Brought On By Presidential Head Implosion during News Confrence</description> </item> - <item> <title>'Cover Letters from ****' Expose Poor Quality of College Grads</title> - <link> - <![CDATA[ http://abcnews.go.com/Business/CareerManagement/story?id=2582776&page=1&CMP=OTC-RSSFeeds0312 ]]> </link> <pubDate>Thu, 19 Oct 2006 14:29:04 -0400</pubDate> <description>A Chicago Adverstising Agency Highlights a Shocking Number of Errors in Job Seekers' Cover Letters</description> </item> ~~snip~~ |
|
#2
|
||||
|
||||
|
You can use the contains() string function to test to see if the
title contains what you're after. Something like: Code:
<xsl:for-each select="item"> <xsl:if test="contains(title,'Bush')"> <p><xsl:value-of select="title" /></p> </xsl:if> </xsl:for-each>
__________________
Support requests via PM will be ignored! |
|
#3
|
|||
|
|||
|
Thanks, that is exactly what I was looking for.
|
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Xsl transform of rss feed help please |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|