<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
	version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns="http://www.w3.org/1999/xhtml">
<xsl:import href="ngsdev-templates.xsl" />
<xsl:output
	method="html"
	encoding="utf-8"
	indent="no"
	omit-xml-declaration="yes" />
<xsl:template match="*" />

<xsl:template match="svn">
<html lang="ja" xml:lang="ja" xmlns="http://www.w3.org/1999/xhtml" id="ngsdev-dot-org" style="background-color:#666;">
	<head>
		<title>
			<xsl:if test="string-length(index/@name)&gt;0">
				<xsl:value-of select="./index/@name"/>
				<xsl:text>: </xsl:text>
			</xsl:if>
			<xsl:value-of select="./index/@path"/>
		</title>
		<xsl:variable name="indexdir">
			<xsl:choose>
				<xsl:when test="count(./localtest)=1"><xsl:text>./</xsl:text></xsl:when>
				<xsl:otherwise><xsl:text>/svnindex/</xsl:text></xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<link rel="stylesheet" type="text/css" href="{$indexdir}svnindex.css"/>
		<script type="text/javascript" src="//ngsdev.org/js/lib/jquery.js">//</script>
		<script type="text/javascript" src="//ngsdev.org/js/site.js">//</script>
		<script type="text/javascript" src="{$indexdir}svnindex.js">//</script>
		<link rel="shortcut icon" href="//ngsdev.org/favicon.ico" />
	</head>
	<body class="svn">
		<div id="wrapper">
			<xsl:call-template name="ngsdev-header" />
			<div id="content-body">
				<xsl:apply-templates mode="filelist" select="./index" />
				<address id="poweredby">
					<xsl:text>Powered by </xsl:text>
					<a href="{@href}" title="Subversion">Subversion</a>
					<xsl:text> </xsl:text>
					<xsl:value-of select="@version" />
				</address>
			</div>
			<xsl:call-template name="ngsdev-footer" />
		</div>
	</body>
</html>
</xsl:template>

<xsl:template match="/svn/index" mode="filelist">
	<xsl:apply-templates select="." mode="h2" />
	<ol id="filelist">
		<xsl:if test="not(@path='Collection of Repositories')">
			<li class="updir" id="updir"><a href="../" title="ParentDirectory">../</a></li>
		</xsl:if>
		<xsl:apply-templates mode="filelist" select="./*" />
	</ol>
	<div class="dummy"><hr /></div>
</xsl:template>

<xsl:template match="/svn/index/file|/svn/index/dir" mode="filelist">
	<li>
		<xsl:attribute name="class">
			<xsl:value-of select="name()" />
			<xsl:if test="position() mod 2 = 0"><xsl:text> sec</xsl:text></xsl:if>
		</xsl:attribute>
		<a href="{@href}" title="{@name}"><xsl:value-of select="@name" /></a>
	</li>
</xsl:template>

<xsl:template match="/" mode="metanavi">
<div id="metanavi">
	<ul>
		<li><a href="/repos/" title="Collection of Repositories">Collection of Repositories</a></li>
	</ul>
</div>
</xsl:template>

<xsl:template match="/" mode="breadcrumbs">
	<xsl:apply-templates select="/svn/index/@path" mode="breadcrumbs" />
</xsl:template>

<xsl:template match="/svn/index[@path='Collection of Repositories']" mode="h2">
	<h2 id="revinfo">Collection of Repositories</h2>
</xsl:template>

<xsl:template match="/svn/index[not(@path='Collection of Repositories')]" mode="h2">
	<h2 id="revinfo">Revision <xsl:value-of select="@rev" /></h2>
</xsl:template>

<xsl:template match="/svn/index/@path[text()='Collection of Repositories']" mode="breadcrumbs">
	<xsl:value-of select="concat('/',.)" />
</xsl:template>

<xsl:template match="/svn/index/@path[not(text()='Collection of Repositories')]" mode="breadcrumbs">
	<xsl:value-of select="concat(' ',.)" />
</xsl:template>

</xsl:stylesheet>
