Created
December 21, 2009 21:02
-
-
Save zoul/261230 to your computer and use it in GitHub Desktop.
Filter RSS using an XSL template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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