<?xml version="1.0" encoding="Shift_JIS" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
                xmlns:my="http://localhost"
                version="1.0">
<xsl:output method="xml" version="1.0" indent="yes" standalone="yes" omit-xml-declaration="no" />
<msxsl:script language="JScript" implements-prefix="my">
<![CDATA[
function makeATag(x,id)
{
	return '<A class="cIdno" name="'+x+id+'" href="#'+x+id+'">'+id+'</A>';
}
function setVolumeNo(no)
{
	CurrVolumeNo = no.item(0).text
	return CurrVolumeNo;
}
function setChapterNo(no)
{
	CurrChapterNo = no.item(0).text
	return getChapterID();;
}
function setParagraphNo(no)
{
	CurrParagraphNo = no.item(0).text
	return getParagraphID();
}
function setLineNo(no)
{
	CurrLineNo = no.item(0).text
	return getLineID();
}
function getVolumeNo()
{
	return CurrVolumeNo;
}
function getChapterNo()
{
	return CurrChapterNo;
}
function getParagraphNo()
{
	return CurrParagraphNo;
}
function getLineNo()
{
	return CurrLineNo;
}
function getChapterID()
{
	return getChapterNo();
}
function getParagraphID()
{
	return getChapterID()+"."+getParagraphNo();
}
function getLineID()
{
	return getParagraphID()+"."+getLineNo();
}
]]>
</msxsl:script>
<xsl:template match="/">
	<HTML>
	<!--TEXTAREA cols="120" rows="34"-->
		<xsl:apply-templates select="//テキスト[@type='本文']" />
	<!--/TEXTAREA-->
	</HTML>
</xsl:template>
<xsl:template match="テキスト">
	<xsl:apply-templates/>
</xsl:template>
<xsl:template match="帖">
	<HEAD>
	<META http-equiv="Content-Type" content="text/html; charset=shift_jis"/>
	<TITLE>源氏物語 <xsl:value-of select="my:setVolumeNo(@no)"/> <xsl:value-of select="@name"/></TITLE>
	<SCRIPT src="combinedUTF16.js"></SCRIPT>
	<LINK id="myStyleSheet2" href="combined.css" rel="STYLESHEET" type="text/css"/>
	</HEAD>
	<BODY>
	<TABLE>
	<TR><TD>
	<A name="settings">
	<SCRIPT>
	writeDisplySettingButtons();
	</SCRIPT>
	</A>
	</TD></TR>
	<TR><TD>
	<TABLE id="tblMain" border="1" cellspacing="0" cellpadding="0">
	<TR class="trTitle">
	<TD></TD>
	<TD align="center" valign="middle" nowrap="true" colspan="4"><B class="cTitle"><BR/><FONT size="7"><A name="top"><xsl:value-of select="@no"/> <xsl:value-of select="@name"/>（<xsl:value-of select="底本"/>）</A></FONT><BR/><BR/></B></TD>
	</TR>
	<xsl:apply-templates/>
	</TABLE>
	</TD></TR>
	</TABLE>
	</BODY>
</xsl:template>
<xsl:template match="章">
	<TR class="trChapterTitle">
	<TD valign="middle" nowrap="true"><xsl:value-of select="my:makeATag('chapter', my:setChapterNo(@no))" disable-output-escaping="yes"/></TD>
	<TD align="center" valign="middle" nowrap="true" colspan="4"><A name="chapter1"></A><B class="cTitle"><BR/><FONT size="5"><xsl:value-of select="@name"/></FONT><BR/><BR/></B></TD>
	<xsl:apply-templates/>
	</TR>
</xsl:template>
<xsl:template match="段">
	<TR class="trParagraphTitle">
	<TD valign="middle" nowrap="true"><xsl:value-of select="my:makeATag('paragraph', my:setParagraphNo(@no))" disable-output-escaping="yes"/></TD>
	<TD align="center" valign="middle" nowrap="true" colspan="4"><A name="paragraph1.1"></A><B class="cTitle"><BR/><FONT size="4"><xsl:value-of select="@name"/></FONT><BR/><BR/></B></TD>
	</TR>
	<xsl:apply-templates/>
</xsl:template>
<xsl:template match="行">
	<TR class="trHonbun">
	<TD nowrap="true"><xsl:value-of select="my:makeATag('line', my:setLineNo(@no))" disable-output-escaping="yes"/></TD>
	<TD><SPAN class="cHonmon"><A name="line1.1.1">　</A><xsl:apply-templates/><BR/></SPAN></TD>
	<TD><SPAN class="cYaku">　<xsl:value-of select="//テキスト[@type='現代語訳']/帖[@no=my:getVolumeNo()]/章[@no=my:getChapterNo()]/段[@no=my:getParagraphNo()]/行[@no=my:getLineNo()]"/><BR/></SPAN></TD>
	<TD><SPAN class="cYosano">　<xsl:value-of select="//テキスト[@type='与謝野晶子訳']/帖[@no=my:getVolumeNo()]/章[@no=my:getChapterNo()]/段[@no=my:getParagraphNo()]/行[@no=my:getLineNo()]"/><BR/></SPAN></TD>
	<TD><SPAN class="cHiragana">　<xsl:value-of select="//テキスト[@type='ひらがな版']/帖[@no=my:getVolumeNo()]/章[@no=my:getChapterNo()]/段[@no=my:getParagraphNo()]/行[@no=my:getLineNo()]"/><BR/></SPAN></TD>
	</TR>
</xsl:template>
</xsl:stylesheet>
