$content = file_get_contents('http://www.pcinpact.com/include/news.xml'); if ( ! $content) { echo "<p>Unable to open remote file.\n"; exit; } $xml = new DOMDocument; $xml->loadXML($content); $xsl = new DOMDocument; $xsl->load('collection.xsl'); $proc = new XSLTProcessor; $proc->importStyleSheet($xsl); echo $proc->transformToXML($xml);
<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="/rss/channel/item[category='Internet']" /> <xsl:template match="/rss/channel/item[category='PC']" /> </xsl:stylesheet>