<?xml version="1.0" encoding="UTF-8"?>

<!-- トップページ/サイト内検索ページ用 XSL -->

<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://www.w3.org/1999/xhtml"
	xmlns:s="http://www.remus.dti.ne.jp/~a-satomi/"
	xmlns:rss="http://purl.org/rss/1.0/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:xalan="http://xml.apache.org/xalan"
	exclude-result-prefixes="h s rss rdf dc xalan">

<xsl:import href="common.xsl"/>

<!-- ================ 出力設定 ================  -->

<xsl:output method="xml"
	encoding="Shift_JIS"
	omit-xml-declaration="no"
	doctype-public="-//W3C//DTD XHTML 1.1//EN"
	doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
	indent="yes"
	xalan:indent-amount="2"
	media-type="application/xhtml+xml"/>

<!-- ================ 各種設定 ================  -->

<xsl:param name="cssFile">toppage.css</xsl:param>

<!-- ================ メインテンプレ ================  -->

<xsl:template match="/h:html">
	<html xml:lang="ja">
	<xsl:apply-templates select="h:head"/>
	<body>
		<xsl:apply-templates select="h:h1/@*"/>

		<xsl:choose>
			<!-- トップページ -->
			<xsl:when test="/h:html/h:h1/@id = 'topPage'">
				<xsl:apply-templates select="h:h1"/>
				<xsl:call-template name="footer"/>
				<xsl:call-template name="counter"/>
			</xsl:when>
			<!-- 他 -->
			<xsl:otherwise>
				<xsl:call-template name="navi"/>
				<xsl:apply-templates select="h:h1"/>
				<xsl:call-template name="navi"/>
				<xsl:call-template name="footer"/>
			</xsl:otherwise>
		</xsl:choose>
	</body>
	</html>
</xsl:template>

<xsl:template match="h:dl">
	<xsl:choose>
		<!-- トップページ -->
		<xsl:when test="/h:html/h:h1/@id = 'topPage'">
			<dl>
				<xsl:apply-templates select="@*"/>
				<xsl:for-each select="h:dt">
					<dt class="item{position()}">
						<xsl:apply-templates/>
					</dt>
					<dd class="item{position()}">
						<xsl:apply-templates select="following-sibling::h:dd[1]/node()"/>
					</dd>
				</xsl:for-each>
			</dl>
		</xsl:when>
		<!-- 他 -->
		<xsl:otherwise>
			<xsl:apply-imports/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<!-- ================ s:rss-link 要素変更 ================  -->

<xsl:template match="s:rss-link">
	<a title="RSS : {$rssLabel}" href="{$rssURI}">
		<img alt="RSS" height="14" width="36" src="{$commonDir}/img/icon/rss.png"/>
	</a>
</xsl:template>

<!-- ================ カウンタ ================  -->

<xsl:template name="counter">
	<div id="counter">
		<a href="http://www.aurora.dti.ne.jp/~zom/Counter/">
			<img title="いつも見に来てくださってありがとうです"
				alt="[PNG counter]" height="45" width="120"
				src="http://alimika.alib.jp/counter/?id=nyan2;set=note;keta=6;opt=2" />
		</a>
	</div>
</xsl:template>

</xsl:stylesheet>
