Skip to content

Instantly share code, notes, and snippets.

@zoul
Created December 21, 2009 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoul/261230 to your computer and use it in GitHub Desktop.
Save zoul/261230 to your computer and use it in GitHub Desktop.
Filter RSS using an XSL template
#!/usr/bin/perl
use Modern::Perl;
use XML::RSS::Tools;
use Perl6::Slurp;
my $style = slurp \*DATA;
my $feed = XML::RSS::Tools->new;
#$feed->set_http_client('lite');
#$feed->debug(1);
$feed->rss_uri('http://www.abclinuxu.cz/auto/abc.rss');
$feed->xsl_string($style);
$feed->transform;
say $feed->as_string;
__DATA__
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="item[starts-with(./title, 'Komiks xkcd')]"/>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment