{"id":251,"date":"2005-05-03T19:39:21","date_gmt":"2005-05-04T01:39:21","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=251"},"modified":"2005-05-03T19:39:21","modified_gmt":"2005-05-04T01:39:21","slug":"using-xslt-to-grab-only-certain-rss-entries","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/251","title":{"rendered":"Using XSLT to grab only certain RSS entries"},"content":{"rendered":"<p>So, as I&#8217;ve <a href='http:\/\/www.mooreds.com\/weblog\/archives\/000237.html'>mentioned before<\/a>, RSS can help you find a job.  However, many jobs in my area are posted to a yahoo group (rmiug-jobs).  I&#8217;m usually interested in seeing new contracts, even if it&#8217;s just to see how the market is doing.  However, subscribing to this email list presents you with four choices:<\/p>\n<p>1. Have your inbox flooded with job postings, most of which don&#8217;t apply to you.  The benefit of this method is that when you do see one that applies, you can respond.  Every single response I&#8217;ve received off of this list was in reply to a mail I sent minutes after seeing the job post; I&#8217;m guessing that almost 8000 members means that any job posters are flooded with resumes.<\/p>\n<p>2. Create a filter so that all the mail messages (or even the ones with interesting subject lines) are pushed to one folder in your email client.  This means that your inbox isn&#8217;t flooded, but that you have to read that folder regularly.  I didn&#8217;t do that often enough to be worthwhile.  In fact, as the messages piled up in that folder, I felt less and less able to read it.  In addition, you may have issues if your filtering rules are complex (I want A and B but not C), though not if you use <a href='http:\/\/www.procmail.org\/'>procmail<\/a>.<\/p>\n<p>3. Get the daily digest and miss out on timely job postings.  I did this for a few months and found that I almost never read the large digest.  I just felt guilty at the bandwidth wastage.<\/p>\n<p>4. Use the search functionality to periodically check for postings of relevance to you.  This helps with research, but doesn&#8217;t deal with the time issue.  And, you have to remember to check periodically.<\/p>\n<p>However, now there&#8217;s a fifth solution.  Yahoo provides an <a href='http:\/\/rss.groups.yahoo.com\/group\/rmiug-jobs\/rss'>RSS feed<\/a> for that group.  (Not all groups seem to have rss provided for them, and I couldn&#8217;t figure out how to turn it on for a group that I moderate.)  <\/p>\n<p>With the magic of XSLT, I was able to write a stylesheet which only grabs entries with interesting keywords in the title, thus avoiding the flooding problem.  RSS is not real time, but it&#8217;s can be close (as close as I want\/am allowed to poll the feed).  Additionally, I&#8217;m a lot more likely to scan it than I would any of the email solutions.<\/p>\n<p>Here&#8217;s the relevant XSLT:<\/p>\n<div><code><\/p>\n<pre>\n&lt;xsl:template match=\"item\"&gt;\n        &lt;xsl:variable name=\"item_link\" select=\"link\"\/&gt;\n        &lt;xsl:variable name=\"item_desc\" select=\"description\"\/&gt;\n        &lt;xsl:variable name=\"item_title\" select=\"title\"\/&gt;\n        &lt;xsl:variable name=\"uc_item_title\" select=\"translate($item_title,'boulderjava','BOULDERJAVA')\"\/&gt;\n        &lt;xsl:choose&gt;\n           &lt;xsl:when test=\"contains($uc_item_title, 'JAVA')\"&gt;\n              &lt;li&gt;&lt;a href=\"{$item_link}\" title=\"{$item_desc}\"&gt;&lt;xsl:value-of select=\"title\"\/&gt;&lt;\/a&gt;&lt;\/li&gt;\n           &lt;\/xsl:when&gt;\n           &lt;xsl:when test=\"contains($uc_item_title, 'BOULDER')\"&gt;\n              &lt;li&gt;&lt;a href=\"{$item_link}\" title=\"{$item_desc}\"&gt;&lt;xsl:value-of select=\"title\"\/&gt;&lt;\/a&gt;&lt;\/li&gt;\n           &lt;\/xsl:when&gt;\n           &lt;xsl:otherwise&gt;\n           &lt;\/xsl:otherwise&gt;\n        &lt;\/xsl:choose&gt;\n\n&lt;\/xsl:template&gt;\n<\/pre>\n<p><\/code><\/div>\n<p>The reason for the translate cheesiness is that the version of the perl RSS module I&#8217;m using does not support the upper-case function (here&#8217;s a <a href='http:\/\/www.w3schools.com\/xpath\/xpath_functions.asp'>useful list of XSLT functions<\/a>).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, as I&#8217;ve mentioned before, RSS can help you find a job. However, many jobs in my area are posted to a yahoo group (rmiug-jobs). I&#8217;m usually interested in seeing [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-251","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=251"}],"version-history":[{"count":0,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/251\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}