$rssfile = "http://www.inittab.de/blog/backports/index.rss";
$xslfile = "xsl/bpo-rss.xsl";
function startElement ($parser, $name, $attrs) {
global $curTag;
$curTag .= "^$name";
}
function endElement ($parser, $name) {
global $curTag, $outxml;
global $title, $link, $desc, $date;
$caretPos = strrpos($curTag, '^');
$curTag = substr($curTag, 0, $caretPos);
if (( $curTag == "^RSS^CHANNEL" ) && ( $name == "ITEM" )) {
$outxml.= "$link$title".
"$desc$date\n";
$date = $title = $desc = $date = "";
}
}
function charData ($parser, $data) {
global $curTag;
global $title, $link, $desc, $date;
if ( $curTag == "^RSS^CHANNEL^ITEM^TITLE" ) {
$title = $data;
} elseif ( $curTag == "^RSS^CHANNEL^ITEM^LINK" ) {
$link = $data;
} elseif ( $curTag == "^RSS^CHANNEL^ITEM^DESCRIPTION") {
$desc .= $data;
} elseif ( $curTag == "^RSS^CHANNEL^ITEM^PUBDATE") {
$date .= $data;
}
}
global $curTag;
$curTag = "";
global $outxml;
$outxml = "\n".
"Debian Backports".
"
Introduction
You are running Debian stable, because you prefer the stable Debian
tree. It runs great, there is just one problem: the software is a little
bit outdated compared to other distributions. That is where backports come
in.
Backports are recompiled packages from testing (mostly) and unstable
(in a few cases only, e.g. security updates), so they will run without new
libraries (wherever it is possible) on a stable Debian distribution. I
recommend you to pick out single backports which fits your needs, and not
to use all backports available here.
-- Norbert Tretkowski aka nobse
Latest News".
"";
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "charData");
if ( !( $fp = @fopen($rssfile, "r"))) {
echo "Resource not available";
} else {
while ( $data = fread($fp, 4096)) {
xml_parse($xml_parser, $data, feof($fp));
}
}
xml_parser_free($xml_parser);
$outxml .= "";
$fd = fopen($xslfile, "r");
$xsl = fread( $fd, filesize($xslfile) );
fclose($fd);
$arguments = array(
'/_xml' => $outxml,
'/_xsl' => $xsl
);
$xh = xslt_create();
xslt_set_base ( $xh, "/var/www/xml/inc/");
xslt_set_encoding( $xh, "UTF-8");
$result = xslt_process( $xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments);
if ($result) {
print "$result";
} else {
print xslt_error($xh);
}
?>