これらのキーワードがハイライトされています:PHP <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rss="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" exclude-result-prefixes="rdf rss dc"> <xsl:output method="xml" encoding="UTF-8" /> <xsl:template match="/"> <xsl:apply-templates select="/rdf:RDF/rss:channel" /> </xsl:template> <xsl:template match="rss:channel"> <CHANNEL HREF="{rss:link}"> <TITLE><xsl:value-of select="rss:title" /></TITLE> <ABSTRACT><xsl:value-of select="rss:description" /></ABSTRACT> <xsl:apply-templates select="//rss:item" /> </CHANNEL > </xsl:template> <xsl:template match="rss:item"> <ITEM HREF="{rss:link}" LASTMOD="{dc:date}"> <TITLE><xsl:value-of select="rss:title" /></TITLE> <ABSTRACT><xsl:value-of select="rss:description" /></ABSTRACT> </ITEM> </xsl:template> </xsl:stylesheet> <?php $url = $_GET["rss"]; $rss = get_data($url); $cdf = convert_rss2cdf($rss); header("Content-Type: application/x-netcdf; charset=UTF-8", true); echo $cdf; function get_data($url) { $ch = curl_init($url); ob_start(); curl_exec($ch); curl_close($ch); $data = ob_get_contents(); ob_end_clean(); return $data; } function convert_rss2cdf($rss) { $xsl = "rss2cdf.xsl"; $xslt = xslt_create(); $cdf = xslt_process($xslt, "arg:/_rss", $xsl, NULL, array("/_rss"=>$rss)); xslt_free($xslt); return $cdf; } ?> <xsl:apply-templates select="//rss:item" /> <xsl:for-each select="rss:items/rdf:Seq/rdf:li"> <xsl:variable name="resource" select="@rdf:resource" /> <xsl:apply-templates select="//rss:item[@rdf:about=$resource]" /> </xsl:for-each>
|