<?php
	if (!isset($_GET['repos'])) {
		header("HTTP/1.1 404 Not Found");
		echo "<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1></body></html>";
		return;
	}

	$logfilename = $_GET['repos'].'.xml';
	if(!file_exists($logfilename)) {
		header("HTTP/1.1 404 Not Found");
		echo "<html><head><title>404 Not Found</title></head><body><h1>Not Found</h1></body></html>";
		return;
	}

	header('Content-type: text/xml; charset=UTF-8');

	// XML ソースをロードする
	$xml = new DOMDocument;
	$xml->load($logfilename);

	$xsl = new DOMDocument;
	$xsl->load("http://".$_SERVER['SERVER_NAME']."/svnlog/svnlog2rss.xsl.php?repos=".$_GET['repos']);

	// 変換の設定を行う
	$proc = new XSLTProcessor;
	// XSL ルールを適用する
	$proc->importStyleSheet($xsl);

	echo $proc->transformToXML($xml);
?>
