<?xml version="1.0" encoding="Shift_JIS" ?>
<xsl:stylesheet
	version="1.0"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:bld="http://www.ylum.gr.jp/2001/bld"
>
<xsl:output
	method="xml"
	version="1.0"
	media-type="text/html"
	omit-xml-declaration="no"
	encoding="Shift_JIS"
	indent="yes"
	doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
/>
<!-- <xsl:namespace-alias stylesheet-prefix="bld" result-prefix="#default"/> --><!--(1)小技-->

<!-- リンクする外部ファイルの拡張子 -->
<xsl:param name="extension">.xml</xsl:param>

<xsl:template match="/INDEX">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"/>
<title><xsl:text>イリューム伯爵城館 - プロフィール - 所有書籍</xsl:text></title>
<meta http-equiv="Content-Script-Type" content="text/javascript"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
<link rel="stylesheet" type="text/css" title="Defalt" href="../../../base.css"/>
<link rel="stylesheet" type="text/css" title="Defalt" href="../../ylum.css"/>
<link rel="stylesheet" type="text/css" title="Defalt" href="../../../dumy.css"/><xsl:comment>IE3用のダミー</xsl:comment>
<link rel="Prev" href="../index.html"/>
<meta name="generator" content="XSLT Convert by Ant" />
</head>

<body>
<xsl:comment> START NAVI BLOCK </xsl:comment>
<div id="naviMenu">
<a href="../index.html">プロフィール</a>
<a href="../../renewal/index.html">管理記録</a>
<a href="../../diary/index.html">城館日記</a>
<a href="../../info/index.html">城館情報</a>
<a href="../../link/index.html">宇宙港</a>
<br />
<a href="http://park15.wakwak.com/%7Eyoshitomo/cgi-bin/ylumBbs/bbs.cgi">記憶巣</a>
<a href="../../cg/index.html">アトリエ</a>
<a href="../../java/index.html">思考結晶</a>
<a href="../../info/sitemap.html">サイトマップ</a>
<br />
<a href="../../top/top.html" target="_top">トップページ</a>
<a href="../../index.html" target="_top">ルートページ</a>
</div>
<xsl:comment> END NAVI BLOCK </xsl:comment>

<hr class="underNavi" />

<xsl:comment> START BODY BLOCK </xsl:comment>
<div id="body">
<script type="text/javascript" src="../../lastModified.js">
<xsl:comment>//  省略形にならないためのダミー// </xsl:comment>
</script>
<h1>所有書籍</h1>
<p>
<a href="m/index.html">モバイル端末用（簡易表示）</a>
</p>
<p>
<a href="#index" title="同ページ内ジャンプ。注意書きを飛ばしてインデックスに移動します。">書籍リストインデックス</a>
</p>
<ul>
	<li>　雑誌以外の書籍で手元にあるもの、または確認が出来るもののリストです。ただし完全ではありません。</li>
	<li>　文字化けを避けるため、機種依存文字となるローマ数字・丸付き数字は通常のアラビア数字に置き換えてあります。</li>
	<li>　一部データを除き、<abbr title="Cascading Style Sheet">CSS</abbr> で出来るだけ背表紙に近い色にしています。</li>
	<li>　上記処理に伴い、例外的にリンクの色を変更してあります。アンダーラインの有無か、カーソルが重なったときに色が変わるかどうかで判別できます。</li>
	<li>　データは所有している本で確認しており、現在販売されているものは違うものがいくつかあります。</li>
	<li>　出版日は奥付によるものであるため、実際の日にちと一致しないことがありえます。（結構多いのです）</li>
	<li>　出版社・作品の公式ウェブサイト・著者の個人ウェブサイトにはリンクを張ってあります。リンクフリーではないと記述してある場合は避けていますが、もしうっかりリンクしてしまってある場合は<a href="../../../aboutMail.html"><em>メールで</em>ご連絡ください</a>。直ちにリンク解除いたします。リンクの仕方に問題がある場合も同様にお願いします。</li>
	<li>　<abbr title="eXtensible Markup Language">XML</abbr> データから <abbr title="XSL Transformations">XSLT</abbr> によって <abbr title="The Extensible HyperText Markup Language">XHTML</abbr> を生成することを目的とした実験コンテンツです。ブラウザによっては正しく表示されない恐れがあります。</li>
</ul>

<hr/>

<h2><a name="index" id="index">書籍リストインデックス</a></h2>
<p>　括弧内の数字は1回以上読み終えた数。</p>
<dl>
<xsl:for-each select="ITEM">
	<dt><a href="{concat(@name,$extension)}"><xsl:value-of select="document(concat(@name,'.xml'))/bld:BOOKS/@title"/></a><xsl:text>　</xsl:text><xsl:value-of select="count(document(concat(@name,'.xml'))//bld:BOOK)"/><xsl:text>(</xsl:text><xsl:value-of select="count(document(concat(@name,'.xml'))//bld:BOOK[@readed='yes'])"/><xsl:text>)冊</xsl:text></dt>
	<xsl:for-each select="document(concat(@name,'.xml'))/bld:BOOKS/bld:GENRE|document(concat(@name,'.xml'))/bld:BOOKS/bld:POCKET-BOOK|document(concat(@name,'.xml'))/bld:BOOKS/bld:COMIC">
	<dd><xsl:value-of select="@title"/><xsl:text>　</xsl:text><xsl:value-of select="count(current()/bld:BOOK) + count(current()/bld:SERIES/bld:BOOK)"/><xsl:text>(</xsl:text><xsl:value-of select="count(current()/bld:BOOK[@readed='yes']) + count(current()/bld:SERIES/bld:BOOK[@readed='yes'])"/><xsl:text>)冊</xsl:text></dd>
	</xsl:for-each>
</xsl:for-each>
</dl>
<xsl:variable name="bookCountAll"><!-- 全ての本を数える -->
<xsl:call-template name="allCounter">
<xsl:with-param name="curent" select="count(/INDEX/ITEM)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="bookCountReaded"><!-- 1度でも読み終えた本を数える -->
<xsl:call-template name="readedCounter">
<xsl:with-param name="curent" select="count(/INDEX/ITEM)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="price"><!-- 全ての本の値段の合計を計算する -->
<xsl:call-template name="allPrice">
<xsl:with-param name="curent" select="count(/INDEX/ITEM)"/>
</xsl:call-template>
</xsl:variable>
<p>　合計、<xsl:value-of select="$bookCountAll"/>(<xsl:value-of select="$bookCountReaded"/>)冊 <xsl:value-of select="format-number($price, '###,###円（外税は考慮していません）')"/></p>
</div>
<xsl:comment> END BODY BLOCK </xsl:comment>

<hr />

<div id="about">
<p>
<xsl:text>　このページは、</xsl:text><abbr title="Extensible Markup Language">XML</abbr><xsl:text> 文書を </xsl:text><abbr title="XSL Transformations">XSLT</abbr><xsl:text> 変換することで生成した、XHTML 1.0 Transitional 形式の文書です。また、デザイン要素は極力 </xsl:text><abbr title="Cascading Style Sheets, level 2">CSS2</abbr><xsl:text> で行うようにしています。</xsl:text>
</p>
<p>
<a href="index.xml" type="application/xml"><xsl:text>XML ファイル</xsl:text></a>
<a href="index.xsl" type="application/xml"><xsl:text>パソコン用 XSLT ファイル</xsl:text></a>
<a href="m/mIndex.xsl" type="application/xml"><xsl:text>モバイル用 XSLT ファイル</xsl:text></a>
</p>
<p>
<a href="http://www.w3.org/Style/CSS/Buttons"><img alt="Made with CSS" src="http://www.w3.org/Style/CSS/Buttons/mwcos" height="31" width="88" /></a>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img alt="Valid CSS!" src="http://jigsaw.w3.org/css-validator/images/vcss" height="31" width="88" /></a>
<a href="http://validator.w3.org/check/referer"><img alt="Valid XHTML 1.0!" src="http://www.w3.org/Icons/valid-xhtml10" height="31" width="88" /></a>
</p>
</div>

<hr />

<xsl:comment> START FOOTER BLOCK </xsl:comment>
<div id="footer">
<xsl:text>Copyright (c) 1997-2003　よしとも</xsl:text>
</div>
<xsl:comment> END FOOTER BLOCK </xsl:comment>
</body>

</html>
</xsl:template>
<!-- メインテンプレート 終了 -->

<!-- 総数計算用テンプレート 開始 -->
<xsl:template name="allCounter">
	<!-- カウントした途中結果 -->
	<xsl:param name="countUp">0</xsl:param>
	<!-- 現時点での処理対象ノードが何番目か -->
	<xsl:param name="curent"/>
	<!-- 計測対象のXMLファイル名を格納する変数 -->
	<xsl:variable name="fileName" select="concat(/INDEX/ITEM[position()=$curent]/@name,'.xml')"/>
	<xsl:choose>
		<xsl:when test="$curent=0"><!-- 最後まで計測したら終わり -->
			<xsl:value-of select="$countUp"/>
		</xsl:when>
		<xsl:otherwise><!-- 途中だったら計測してそれまでの結果に加算し、再帰呼び出しをする -->
			<xsl:call-template name="allCounter">
			<xsl:with-param name="countUp" select="$countUp + count(document($fileName)//bld:BOOK)"/>
			<xsl:with-param name="curent" select="$curent - 1"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!-- 総数計算用テンプレート 終了 -->

<!-- 読書済み数計算用テンプレート 開始 -->
<xsl:template name="readedCounter">
	<!-- カウントした途中結果 -->
	<xsl:param name="countUp">0</xsl:param>
	<!-- 現時点での処理対象ノードが何番目か -->
	<xsl:param name="curent"/>
	<!-- 計測対象のXMLファイル名を格納する変数 -->
	<xsl:variable name="fileName" select="concat(/INDEX/ITEM[position()=$curent]/@name,'.xml')"/>
	<xsl:choose>
		<xsl:when test="$curent=0"><!-- 最後まで計測したら終わり -->
			<xsl:value-of select="$countUp"/>
		</xsl:when>
		<xsl:otherwise><!-- 途中だったら計測してそれまでの結果に加算し、再帰呼び出しをする -->
			<xsl:call-template name="readedCounter">
			<xsl:with-param name="countUp" select="$countUp + count(document($fileName)//bld:BOOK[@readed='yes'])"/>
			<xsl:with-param name="curent" select="$curent - 1"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!-- 読書済み総数計算用テンプレート 終了 -->

<!-- 合計金額計算用テンプレート 開始 -->
<xsl:template name="allPrice">
	<!-- カウントした途中結果 -->
	<xsl:param name="priceUp">0</xsl:param>
	<!-- 現時点での処理対象ノードが何番目か -->
	<xsl:param name="curent"/>
	<!-- 計測対象のXMLファイル名を格納する変数 -->
	<xsl:variable name="fileName" select="concat(/INDEX/ITEM[position()=$curent]/@name,'.xml')"/>
	<xsl:choose>
		<xsl:when test="$curent=0"><!-- 最後まで計測したら終わり -->
			<xsl:value-of select="$priceUp"/>
		</xsl:when>
		<xsl:otherwise><!-- 途中だったら計測してそれまでの結果に加算し、再帰呼び出しをする -->
			<xsl:call-template name="allPrice">
			<xsl:with-param name="priceUp" select="$priceUp + number(sum(document($fileName)//bld:PRICE/text()))"/>
			<xsl:with-param name="curent" select="$curent - 1"/>
			</xsl:call-template>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>
<!-- 合計金額計算用テンプレート 終了 -->

</xsl:stylesheet>
