<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0"
  xmlns:p="http://www.asahi-net.or.jp/~AE5T-KSN/anime/prog.dtd"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output
    standalone="yes"
    method="html"
    encoding="iso-2022-jp"
    indent="yes"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"/>
  <xsl:template match="p:proglist">
    <html lang="ja">
      <head>
	<link rev="made" href="mailto:AE5T-KSN@asahi-net.or.jp" />
	<link rel="PREV" href="http://www.asahi-net.or.jp/~AE5T-KSN/anime/" />
	<meta http-equiv="Content-Style-Type" content="text/css" />
	<link rel="stylesheet" href="newprog.css" />
	<title>新番組一覧</title>
      </head>
      <body>
	<h1>新番組一覧</h1>
	<xsl:apply-templates select="p:lastmodified" />
	<xsl:apply-templates select="p:preamble" />
	<hr />
	<h2 class="toc">目次</h2>
	<table cellspacing="0" width="100%" cellpadding="1">
	  <xsl:for-each select="p:prog">
	    <tr>
	      <td width="15%">
		<xsl:choose>
		  <xsl:when test="position() = 1">
		    <xsl:attribute name="class">
		      <xsl:text>top</xsl:text>
		    </xsl:attribute>
		  </xsl:when>
		  <xsl:when test="position() = last()">
		    <xsl:attribute name="class">
		      <xsl:text>bottom</xsl:text>
		    </xsl:attribute>
		  </xsl:when>
		</xsl:choose>
		<xsl:choose>
		  <xsl:when test="p:date">
		    <xsl:value-of select="p:date/@year" />/<xsl:value-of select="p:date/@month" />/<xsl:value-of select="p:date/@day" /><xsl:value-of select="p:date/@aday" />
		  </xsl:when>
		  <xsl:when test="p:start">
		    <xsl:value-of select="p:start/@year" /><xsl:choose><xsl:when test="p:start/@aday"> 年<xsl:value-of select="p:start/@aday" /></xsl:when><xsl:when test="p:start/@month">/<xsl:value-of select="p:start/@month" /><xsl:if test="p:start/@day">/</xsl:if><xsl:value-of select="p:start/@day" /></xsl:when></xsl:choose>〜
		  </xsl:when>
                  <xsl:otherwise>-</xsl:otherwise>
		</xsl:choose>
	      </td>
	      <td width="40%" xsl:use-attribute-sets="tdstyle">
		<xsl:choose>
		  <xsl:when test="position() = 1">
		    <xsl:attribute name="class">
		      <xsl:text>top</xsl:text>
		    </xsl:attribute>
		  </xsl:when>
		  <xsl:when test="position() = last()">
		    <xsl:attribute name="class">
		      <xsl:text>bottom</xsl:text>
		    </xsl:attribute>
		  </xsl:when>
		</xsl:choose>
		<xsl:value-of select="p:station"/>
		&#160;
	      </td>
	      <td width="45%" xsl:use-attribute-sets="tdstyle">
		<xsl:choose>
		  <xsl:when test="position() = 1">
		    <xsl:attribute name="class">
		      <xsl:text>top</xsl:text>
		    </xsl:attribute>
		  </xsl:when>
		  <xsl:when test="position() = last()">
		    <xsl:attribute name="class">
		      <xsl:text>bottom</xsl:text>
		    </xsl:attribute>
		  </xsl:when>
		</xsl:choose>
		<a href="#{@key}"><xsl:value-of select="p:title"/></a>
	      </td>
	    </tr>
	  </xsl:for-each>
	</table>
	<hr />
	<xsl:apply-templates select="p:prog"/>
	<hr />
	<p class="desc"><a href="./">戻る</a></p>
      </body>
    </html>
  </xsl:template>

  <xsl:template match="p:lastmodified">
    <p class="date"><xsl:apply-templates/>更新</p>
  </xsl:template>

  <xsl:template match="p:prog">
    <h2><a name="{@key}"><xsl:apply-templates select="p:title"/></a></h2>
    <xsl:apply-templates select="p:comment"/>
    <ul>
      <xsl:apply-templates select="p:date"/>
      <xsl:apply-templates select="p:time"/>
      <xsl:apply-templates select="p:station"/>
      <xsl:apply-templates select="p:start"/>
    </ul>
    <xsl:apply-templates select="p:stafflist"/>
    <xsl:apply-templates select="p:castlist"/>
    <xsl:apply-templates select="p:urllist"/>
  </xsl:template>
  
  <xsl:template match="p:comment">
    <p class="desc"><xsl:apply-templates/></p>
  </xsl:template>
  
  <xsl:template match="p:date">
    <li>放映日: <xsl:value-of select="@year"/>/<xsl:value-of select="@month"/>/<xsl:value-of select="@day"/><xsl:value-of select="@aday"/></li>
  </xsl:template>
  
  <xsl:template match="p:time">
    <li>放映枠: <xsl:apply-templates/></li>
  </xsl:template>
  
  <xsl:template match="p:station">
    <li>放送局: <xsl:apply-templates/></li>
  </xsl:template>

  <xsl:template match="p:start">
    <li>放映開始: <xsl:value-of select="@year"/>/<xsl:value-of select="@month"/>/<xsl:value-of select="@day"/><xsl:value-of select="@aday"/></li>
  </xsl:template>

  <xsl:template match="p:stafflist">
    <h3>スタッフ</h3>
    <ul>
      <xsl:apply-templates select="p:staff"/>
    </ul>
  </xsl:template>
  
  <xsl:template match="p:staff">
    <li><xsl:value-of select="@title"/>: <xsl:apply-templates/></li>
  </xsl:template>
  
  <xsl:template match="p:castlist">
    <h3>キャスト</h3>
    <ul>
      <xsl:apply-templates select="p:cast"/>
    </ul>
  </xsl:template>
  
  <xsl:template match="p:cast">
    <li><xsl:value-of select="@role"/>: <xsl:apply-templates/></li>
  </xsl:template>
  
  <xsl:template match="p:urllist">
    <h3>関連URL</h3>
    <ul>
      <xsl:apply-templates select="p:url"/>
    </ul>
  </xsl:template>
  
  <xsl:template match="p:url">
    <li><a href="{@href}"><xsl:apply-templates/></a></li>
  </xsl:template>

  <xsl:template match="p:preamble">
    <xsl:copy-of select="child::*" />
  </xsl:template>

</xsl:stylesheet>
<!--
 Local Variables:
 mode:xml
 coding:utf-8
 End:
-->
