<?xml version="1.0" encoding="Shift_JIS"?>
<!-- edited with xmlspy v5 rel. 4 U (http://www.xmlspy.com) by Kando Takayuki ((personal)) -->
<!-- edited with xmlspy v5 rel. 4 U (http://www.xmlspy.com) by Kando Takayuki ((personal)) -->
<!-- edited with xmlspy v5 rel. 4 U (http://www.xmlspy.com) by Kando Takayuki ((personal)) -->
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by KANDO Takayuki ((none)) -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:lore="http://www.nerimadors.or.jp/~kando/loreML">
	<xsl:output encoding="Shift_JIS" media-type="text/html" version="4.0" indent="yes"/>
	<xsl:variable name="TAB_COLS" select="3"/>
	<xsl:template match="/">
		<xsl:apply-templates select="lore:Character" mode="Page"/>
	</xsl:template>
	<xsl:template match="lore:RQ">
		<xsl:apply-templates select="lore:Copyright"/>
		<xsl:apply-templates select="lore:Characters"/>
	</xsl:template>
	<xsl:template match="lore:Characters">
		<xsl:apply-templates select="lore:Character" mode="NewPage"/>
	</xsl:template>
	<xsl:template match="lore:Character" mode="Page">
		<html>
			<head>
				<link rel="stylesheet" type="text/css" href="RQCharDefault.css"/>
				<title>RuneQuest Character sheet</title>
			</head>
			<body>
				<xsl:apply-templates select="." mode="PageContent"/>
			</body>
		</html>
	</xsl:template>
	<xsl:template match="lore:Character" mode="PageContent">
		<xsl:variable name="EquipmentsENC">
			<xsl:apply-templates select="lore:Items" mode="ENC">
				<xsl:with-param name="enc" select="0"/>
			</xsl:apply-templates>
		</xsl:variable>
		<xsl:variable name="ActionModifier">
			<xsl:apply-templates select="lore:Ability" mode="ActionModifier"/>
		</xsl:variable>
		<xsl:variable name="NegotiationModifier">
			<xsl:apply-templates select="lore:Ability" mode="NegotiationModifier"/>
		</xsl:variable>
		<xsl:variable name="KnowledgeModifier">
			<xsl:apply-templates select="lore:Ability" mode="KnowledgeModifier"/>
		</xsl:variable>
		<xsl:variable name="ManipulationModifier">
			<xsl:apply-templates select="lore:Ability" mode="ManipulationModifier"/>
		</xsl:variable>
		<xsl:variable name="PerceptionModifier">
			<xsl:apply-templates select="lore:Ability" mode="PerceptionModifier"/>
		</xsl:variable>
		<xsl:variable name="SecretModifier">
			<xsl:apply-templates select="lore:Ability" mode="SecretModifier"/>
		</xsl:variable>
		<xsl:variable name="MagicModifier">
			<xsl:apply-templates select="lore:Ability" mode="MagicModifier"/>
		</xsl:variable>
		<xsl:variable name="DamageModifier">
			<xsl:apply-templates select="lore:Ability" mode="DamageModifier"/>
		</xsl:variable>
		<xsl:variable name="DEX_SRM">
			<xsl:apply-templates select="lore:Ability" mode="DEXSR"/>
		</xsl:variable>
		<xsl:variable name="SIZ_SRM">
			<xsl:apply-templates select="lore:Ability" mode="SIZSRM"/>
		</xsl:variable>
		<xsl:variable name="SRM">
			<xsl:apply-templates select="lore:Ability" mode="SRM"/>
		</xsl:variable>
		<xsl:variable name="TotalHP_base">
			<xsl:apply-templates select="lore:Ability" mode="TotalHP_base"/>
		</xsl:variable>
		<xsl:variable name="MP_base">
			<xsl:apply-templates select="lore:Ability" mode="POW"/>
		</xsl:variable>
		<xsl:variable name="FP_base">
			<xsl:apply-templates select="lore:Ability" mode="FP_base"/>
		</xsl:variable>
		<xsl:apply-templates select="lore:Copyright" mode="Comment"/>
		<xsl:text>&#xA;</xsl:text>
		<h1>
			<em>RuneQuest<span class="note">(TM)</span>
			</em>
			<strong> ƒLƒƒƒ‰ƒNƒ^[ƒV[ƒg</strong>
			<xsl:choose>
				<xsl:when test="./@id">
					<span class="note"> (ID: <xsl:value-of select="./@id"/> )</span>
				</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
		</h1>
		<xsl:text>&#xA;</xsl:text>
		<p>
			<xsl:if test="lore:Description/@image">
				<img class="right" src="{lore:Description/@image}" alt="[ƒLƒƒƒ‰ƒNƒ^[‚Ì‰æ‘œ]" width="200"/>
			</xsl:if>
			<em>–`Œ¯ŽÒ‚Ì–¼‘O : </em>
			<strong>
				<xsl:value-of select="lore:Name"/>
			</strong>
			<strong>
				<xsl:value-of select="lore:FamilyName"/>
			</strong> ƒ<em>
				<xsl:value-of select="lore:Title"/>
			</em> „( <strong>
				<xsl:value-of select="lore:NickName"/>
			</strong> )<br/>
			<xsl:text>&#xA;</xsl:text>
			<em>ƒvƒŒƒCƒ„[‚Ì–¼‘O : </em>
			<strong>
				<xsl:value-of select="lore:Player"/>
			</strong>
			<br/>
			<xsl:text>&#xA;</xsl:text>
			<em> ( mail: <a href="mailto:{lore:Player/@mail}">
					<xsl:value-of select="lore:Player/@mail"/>
				</a> web:  <a href="{lore:Player/@web}">
					<xsl:value-of select="lore:Player/@web"/>
				</a> )</em>
			<br/>
			<xsl:text>&#xA;</xsl:text>
			<em> Ží‘° : </em>
			<strong>
				<xsl:value-of select="lore:Profile/lore:Race"/>
			</strong>
			<em> / ˆÚ“® : </em>
			<strong>
				<xsl:value-of select="lore:Profile/@move"/>
			</strong>
			<em> m / og’n/•”‘° : </em>
			<strong>
				<xsl:value-of select="lore:Profile/lore:Roots"/>
			</strong>
			<br/>
			<xsl:text>&#xA;</xsl:text>
			<em> ”N—î : </em>
			<strong>
				<xsl:value-of select="lore:Profile/@age"/>
			</strong>
			<em> / «•Ê : </em>
			<strong>
				<xsl:choose>
					<xsl:when test="'Male'=lore:Profile/@sex">’j«</xsl:when>
					<xsl:when test="'Female'=lore:Profile/@sex">—«</xsl:when>
					<xsl:when test="'Monoecism'=lore:Profile/@sex">—¼«</xsl:when>
					<xsl:otherwise>–³«</xsl:otherwise>
				</xsl:choose>
			</strong>
			<em> / ŽÐ‰ï : </em>
			<strong>
				<xsl:choose>
					<xsl:when test="'Primitive'=lore:Profile/lore:Roots/@society">–¢ŠJŽÐ‰ï</xsl:when>
					<xsl:when test="'Nomadic'=lore:Profile/lore:Roots/@society">—V–qŽÐ‰ï</xsl:when>
					<xsl:when test="'Barbarian'=lore:Profile/lore:Roots/@society">”Ø‘°ŽÐ‰ï</xsl:when>
					<xsl:when test="'Monarchy'=lore:Profile/lore:Roots/@society">ŒNŽåŽÐ‰ï</xsl:when>
					<xsl:otherwise> - </xsl:otherwise>
				</xsl:choose>
			</strong>
			<em> / E‹Æ : </em>
			<strong>
				<xsl:value-of select="lore:Profile/lore:Profession"/> (<xsl:value-of select="lore:Profile/lore:Profession/@years"/>)</strong>
			<br/>
			<xsl:text>&#xA;</xsl:text>
			<em> @‹³ : </em>
			<strong>
				<xsl:apply-templates select="lore:Profile/lore:Cult"/>
			</strong>
			<br/>
			<xsl:text>&#xA;</xsl:text>
			<em> ˆóÛ : </em>
			<strong>
				<xsl:value-of select="lore:Description"/>
			</strong>
			<br/>
			<xsl:text>&#xA;</xsl:text>
			<em>Šî–{”\—Í’l </em>
			<xsl:apply-templates select="lore:Ability"/>
		</p>
		<p>
			<span class="attention">
				<em>ƒg[ƒ^ƒ‹HP: </em>
				<strong>
					<xsl:value-of select="$TotalHP_base + lore:Ability/lore:HP/@growth"/>
				</strong>
				<em>/</em>
				<strong>
					<xsl:value-of select="$TotalHP_base"/>
				</strong>
			</span>
			<table rules="cols" frame="void" border="1">
				<tbody>
					<tr>
						<td>
							<em>•”ˆÊ</em>
						</td>
						<td>
							<em>‹ßÚ</em>
						</td>
						<td>
							<em>ŽËŒ‚</em>
						</td>
						<td>
							<em>HP</em>
						</td>
						<td>
							<em>AP</em>
						</td>
					</tr>
					<xsl:apply-templates select="lore:Ability/lore:HP/lore:PartHP[1]" mode="recursion">
						<xsl:with-param name="TotalHP_base" select="$TotalHP_base"/>
						<xsl:with-param name="HitRangeCount" select="0"/>
						<xsl:with-param name="ShotRangeCount" select="0"/>
					</xsl:apply-templates>
				</tbody>
			</table>
			<span class="attention">
				<em>MP: </em>
				<strong>
					<xsl:value-of select="$MP_base + lore:Ability/lore:MP/@growth"/>
				</strong>
				<em>/</em>
				<strong>
					<xsl:value-of select="$MP_base"/>
				</strong>
				<br/>
				<em>FP: </em>
				<strong>
					<xsl:value-of select="$FP_base - floor($EquipmentsENC) + lore:Ability/lore:FP/@growth"/>
				</strong>
				<em>/</em>
				<xsl:comment> ENC: <xsl:value-of select="$EquipmentsENC"/>
				</xsl:comment>
				<strong>
					<xsl:value-of select="$FP_base - floor($EquipmentsENC)"/>
				</strong>
				<em>(<xsl:value-of select="$FP_base"/>-ENC)</em>
			</span>
		</p>
		<p>
			<em>‰^“®‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$ActionModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Action']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$ActionModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>ŒðÂ‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$NegotiationModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Negotiation']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$NegotiationModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>’mŽ¯‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$KnowledgeModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Knowledge']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$KnowledgeModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>‘€ì‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$ManipulationModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Manipulation']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$ManipulationModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>’mŠo‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$PerceptionModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Perception']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$PerceptionModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>‰B–§‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$SecretModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Secret']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$SecretModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
		</p>
		<p>
			<em>–‚p‹Z”\ (C³’l : </em>
			<strong>
				<xsl:value-of select="$MagicModifier"/>
			</strong>
			<em>)</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Skills/lore:Skill[@type='Magic']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$MagicModifier"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<xsl:variable name="POW">
				<xsl:apply-templates select="lore:Ability" mode="POW"/>
			</xsl:variable>
			<em>¸—ì–‚p</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Spells/lore:Spell[@type='Spiritual']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$POW"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>_«–‚p</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Spells/lore:Spell[@type='Devine']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$POW"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
			<em>–‚–@–‚p</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:call-template name="TableMaker">
				<xsl:with-param name="nodes" select="lore:Spells/lore:Spell[@type='Magic']"/>
				<xsl:with-param name="cols" select="$TAB_COLS"/>
				<xsl:with-param name="option1" select="$POW"/>
				<xsl:with-param name="option2" select="$EquipmentsENC"/>
			</xsl:call-template>
		</p>
		<p>
			<em>•Ší‹Z”\ (UŒ‚%C³’l: </em>
			<strong>
				<xsl:value-of select="$ManipulationModifier"/>
			</strong>
			<em> / Žó‚¯%C³’l: </em>
			<strong>
				<xsl:value-of select="$ActionModifier"/>
			</strong>
			<em> / ƒ_ƒ[ƒWC³’l : </em>
			<strong>
				<xsl:value-of select="$DamageModifier"/>
			</strong>
			<em> / DEX SR : </em>
			<strong>
				<xsl:value-of select="$DEX_SRM"/>
			</strong>
			<em> + SIZ SRM : </em>
			<strong>
				<xsl:value-of select="$SIZ_SRM"/>
			</strong>
			<em> = ‹ßÚSRM : </em>
			<strong>
				<xsl:value-of select="$SRM"/>
			</strong>
			<em> )</em>
			<xsl:text>&#xA;</xsl:text>
			<xsl:apply-templates select="lore:Skills" mode="AttackSkill">
				<xsl:with-param name="ManipulationModifier" select="$ManipulationModifier"/>
				<xsl:with-param name="ActionModifier" select="$ActionModifier"/>
				<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
				<xsl:with-param name="SRM" select="$SRM"/>
				<xsl:with-param name="DEX_SRM" select="$DEX_SRM"/>
			</xsl:apply-templates>
		</p>
		<xsl:apply-templates select="lore:Items" mode="Enumerate"/>
	</xsl:template>
	<xsl:template match="lore:Copyright" mode="Comment">&#xA;<xsl:comment>&#xA;&#x9;date: <xsl:value-of select="@date"/> version: <xsl:value-of select="@version"/> edition: <xsl:value-of select="@edition"/>&#xA;<xsl:apply-templates select="lore:Author" mode="CommentContent"/>
			<xsl:apply-templates select="lore:Reference" mode="CommentContent"/>
		</xsl:comment>&#xA;</xsl:template>
	<xsl:template match="lore:Author" mode="CommentContent">&#xA;&#x9;name:&#x9;<xsl:value-of select="."/>
		<xsl:if test="@web">&#xA;&#x9;&#x9;web:&#x9;<xsl:value-of select="@web"/>
		</xsl:if>
		<xsl:if test="@mail">&#xA;&#x9;&#x9;mail:&#x9;<xsl:value-of select="@mail"/>
		</xsl:if>
	</xsl:template>
	<xsl:template match="lore:Reference" mode="CommentContent">&#xA;&#x9;*reference*<xsl:if test="@web">&#xA;&#x9;&#x9;web:&#x9;<xsl:value-of select="@web"/>
		</xsl:if>
		<xsl:if test="@mail">&#xA;&#x9;&#x9;mail:&#x9;<xsl:value-of select="@mail"/>
		</xsl:if>&#xA;<xsl:value-of select="."/>
	</xsl:template>
	<xsl:template match="lore:Ability">
		<table rules="cols" frame="void" border="1">
			<thead>
				<tr>
					<th/>
					<th>STR</th>
					<th>CON</th>
					<th>SIZ</th>
					<th>INT</th>
					<th>POW</th>
					<th>DEX</th>
					<th>APP</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>
						<em>–{—ˆ</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:STR/@val"/>
						</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:CON/@val"/>
						</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:SIZ/@val"/>
						</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:INT/@val"/>
						</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:POW/@val"/>
						</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:DEX/@val"/>
						</em>
					</td>
					<td>
						<em>
							<xsl:value-of select="lore:APP/@val"/>
						</em>
					</td>
				</tr>
				<tr>
					<td>
						<em>Œ»Ý</em>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:STR/@growth">
										<xsl:value-of select="lore:STR/@val+lore:STR/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:STR/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:CON/@growth">
										<xsl:value-of select="lore:CON/@val+lore:CON/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:CON/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:SIZ/@growth">
										<xsl:value-of select="lore:SIZ/@val+lore:SIZ/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:SIZ/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:INT/@growth">
										<xsl:value-of select="lore:INT/@val+lore:INT/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:INT/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:POW/@growth">
										<xsl:value-of select="lore:POW/@val+lore:POW/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:POW/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:DEX/@growth">
										<xsl:value-of select="lore:DEX/@val+lore:DEX/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:DEX/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
					<td align="right">
						<span class="attention">
							<strong>
								<xsl:choose>
									<xsl:when test="lore:APP/@growth">
										<xsl:value-of select="lore:APP/@val+lore:APP/@growth"/>*</xsl:when>
									<xsl:otherwise>
										<xsl:value-of select="lore:APP/@val"/>
									</xsl:otherwise>
								</xsl:choose>
							</strong>
						</span>
					</td>
				</tr>
			</tbody>
		</table>
	</xsl:template>
	<xsl:template name="SecondFactor">
		<xsl:param name="SCORE"/>
		<xsl:choose>
			<xsl:when test="($SCORE - 10)&lt;20">
				<xsl:value-of select="ceiling(($SCORE - 10) div 2)"/>
			</xsl:when>
			<xsl:otherwise>10</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="ActionModifier">
		<xsl:variable name="STR">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:STR/@val+number(translate(number(lore:STR/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="SIZ" select="-(lore:SIZ/@val+number(translate(number(lore:SIZ/@growth), 'NaN', '0'))-10)"/>
		<xsl:variable name="DEX" select="lore:DEX/@val+number(translate(number(lore:DEX/@growth), 'NaN', '0'))-10"/>
		<xsl:value-of select="$STR+$SIZ+$DEX"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="NegotiationModifier">
		<xsl:variable name="INT" select="lore:INT/@val+number(translate(number(lore:INT/@growth), 'NaN', '0'))-10"/>
		<xsl:variable name="POW">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:POW/@val+number(translate(number(lore:POW/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="APP">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:APP/@val+number(translate(number(lore:APP/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:value-of select="$INT+$POW+$APP"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="KnowledgeModifier">
		<xsl:value-of select="lore:INT/@val+number(translate(number(lore:INT/@growth), 'NaN', '0'))-10"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="ManipulationModifier">
		<xsl:variable name="STR">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:STR/@val+number(translate(number(lore:STR/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="INT" select="lore:INT/@val+number(translate(number(lore:INT/@growth), 'NaN', '0'))-10"/>
		<xsl:variable name="DEX" select="lore:DEX/@val+number(translate(number(lore:DEX/@growth), 'NaN', '0'))-10"/>
		<xsl:value-of select="$STR+$INT+$DEX"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="PerceptionModifier">
		<xsl:variable name="CON">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:CON/@val+number(translate(number(lore:CON/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="INT" select="lore:INT/@val+number(translate(number(lore:INT/@growth), 'NaN', '0'))-10"/>
		<xsl:variable name="POW">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:POW/@val+number(translate(number(lore:POW/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:value-of select="$CON+$INT+$POW"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="SecretModifier">
		<xsl:variable name="SIZ" select="-(lore:SIZ/@val+number(translate(number(lore:SIZ/@growth), 'NaN', '0'))-10)"/>
		<xsl:variable name="POW" select="-(lore:POW/@val+number(translate(number(lore:POW/@growth), 'NaN', '0'))-10)"/>
		<xsl:variable name="DEX" select="lore:DEX/@val+number(translate(number(lore:DEX/@growth), 'NaN', '0'))-10"/>
		<xsl:value-of select="$SIZ+$POW+$DEX"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="MagicModifier">
		<xsl:variable name="INT" select="lore:INT/@val+number(translate(number(lore:INT/@growth), 'NaN', '0'))-10"/>
		<xsl:variable name="POW" select="lore:POW/@val+number(translate(number(lore:POW/@growth), 'NaN', '0'))-10"/>
		<xsl:variable name="DEX">
			<xsl:call-template name="SecondFactor">
				<xsl:with-param name="SCORE">
					<xsl:value-of select="lore:DEX/@val+number(translate(number(lore:DEX/@growth), 'NaN', '0'))"/>
				</xsl:with-param>
			</xsl:call-template>
		</xsl:variable>
		<xsl:value-of select="$INT+$POW+$DEX"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="POW">
		<xsl:value-of select="lore:POW/@val+number(translate(number(lore:POW/@growth), 'NaN', '0'))"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="FP_base">
		<xsl:value-of select="lore:STR/@val+lore:CON/@val+number(translate(number(lore:STR/@growth), 'NaN', '0'))+number(translate(number(lore:CON/@growth), 'NaN', '0'))"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="TotalHP_base">
		<xsl:value-of select="ceiling((lore:SIZ/@val+lore:CON/@val+number(translate(number(lore:SIZ/@growth), 'NaN', '0'))+number(translate(number(lore:CON/@growth), 'NaN', '0'))) div 2)"/>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="DamageModifier">
		<xsl:variable name="SUM" select="lore:STR/@val+lore:SIZ/@val+number(translate(number(lore:STR/@growth), 'NaN', '0'))+number(translate(number(lore:SIZ/@growth), 'NaN', '0'))"/>
		<xsl:choose>
			<xsl:when test="$SUM&lt;13">-1D4</xsl:when>
			<xsl:when test="$SUM&lt;25">0</xsl:when>
			<xsl:when test="$SUM&lt;33">+1D4</xsl:when>
			<xsl:when test="$SUM&lt;41">+1D6</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="concat('+', string(ceiling(($SUM - 40) div 16)+1), 'D6')"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="DEXSR">
		<xsl:variable name="DEX" select="lore:DEX/@val+number(translate(number(lore:DEX/@growth), 'NaN', '0'))"/>
		<xsl:choose>
			<xsl:when test="$DEX&lt;10">4</xsl:when>
			<xsl:when test="$DEX&lt;16">3</xsl:when>
			<xsl:when test="$DEX&lt;20">2</xsl:when>
			<xsl:otherwise>1</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="SIZSRM">
		<xsl:variable name="SIZ" select="lore:SIZ/@val+number(translate(number(lore:SIZ/@growth), 'NaN', '0'))"/>
		<xsl:choose>
			<xsl:when test="$SIZ&lt;10">3</xsl:when>
			<xsl:when test="$SIZ&lt;16">2</xsl:when>
			<xsl:when test="$SIZ&lt;20">1</xsl:when>
			<xsl:otherwise>0</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Ability" mode="SRM">
		<xsl:variable name="DEXSR">
			<xsl:apply-templates select="." mode="DEXSR"/>
		</xsl:variable>
		<xsl:variable name="SIZSRM">
			<xsl:apply-templates select="." mode="SIZSRM"/>
		</xsl:variable>
		<xsl:value-of select="$DEXSR+$SIZSRM"/>
	</xsl:template>
	<xsl:template match="lore:PartHP" mode="recursion">
		<xsl:param name="TotalHP_base"/>
		<xsl:param name="HitRangeCount"/>
		<xsl:param name="ShotRangeCount"/>
		<xsl:variable name="PartsName" select="string(.)"/>
		<xsl:variable name="PartsHP" select="ceiling($TotalHP_base * @ratio)"/>
		<xsl:variable name="PartsAP">
			<xsl:apply-templates select="ancestor::lore:HP/ancestor::lore:Character/lore:Items" mode="AP">
				<xsl:with-param name="part_name" select="string(.)"/>
				<xsl:with-param name="ap" select="0"/>
			</xsl:apply-templates>
		</xsl:variable>
		<tr>
			<td>
				<strong>
					<xsl:value-of select="$PartsName"/>
				</strong>
			</td>
			<td align="center">
				<xsl:choose>
					<xsl:when test="@hit_range = 1">
						<em>
							<xsl:value-of select="$HitRangeCount + 1"/>
						</em>
					</xsl:when>
					<xsl:otherwise>
						<em>
							<xsl:value-of select="$HitRangeCount + 1"/>-<xsl:value-of select="$HitRangeCount + @hit_range"/>
						</em>
					</xsl:otherwise>
				</xsl:choose>
			</td>
			<td align="center">
				<xsl:choose>
					<xsl:when test="@shot_range = 1">
						<em>
							<xsl:value-of select="$ShotRangeCount + 1"/>
						</em>
					</xsl:when>
					<xsl:otherwise>
						<em>
							<xsl:value-of select="$ShotRangeCount + 1"/>-<xsl:value-of select="$ShotRangeCount + @shot_range"/>
						</em>
					</xsl:otherwise>
				</xsl:choose>
			</td>
			<td>
				<span class="attention">
					<strong>
						<xsl:value-of select="$PartsHP + @growth"/>
					</strong>
					<em>/</em>
					<strong>
						<xsl:value-of select="$PartsHP"/>
					</strong>
				</span>
			</td>
			<td>
				<span class="attention">
					<strong>
						<xsl:value-of select="$PartsAP"/>
					</strong>
				</span>
			</td>
			<xsl:if test="@scar">
				<td>
					<em>Õ: </em>
					<strong>
						<xsl:value-of select="@scar"/>
					</strong>
				</td>
			</xsl:if>
			<xsl:if test="following-sibling::lore:PartHP[1]">
				<xsl:apply-templates select="following-sibling::lore:PartHP[1]" mode="recursion">
					<xsl:with-param name="TotalHP_base" select="$TotalHP_base"/>
					<xsl:with-param name="HitRangeCount" select="$HitRangeCount + @hit_range"/>
					<xsl:with-param name="ShotRangeCount" select="$ShotRangeCount + @shot_range"/>
				</xsl:apply-templates>
			</xsl:if>
		</tr>
	</xsl:template>
	<xsl:template name="TableMaker">
		<xsl:param name="nodes"/>
		<xsl:param name="cols"/>
		<xsl:param name="option1"/>
		<xsl:param name="option2"/>
		<table>
			<tbody>
				<xsl:for-each select="$nodes[(position() mod $cols)=1]">
					<xsl:variable name="start" select="((position()-1)*$cols)+1"/>
					<xsl:variable name="end" select="$start+$cols"/>
					<tr>
						<xsl:apply-templates select="$nodes[(position() >= $start) and ($end > position())]" mode="TD">
							<xsl:with-param name="OPT1" select="$option1"/>
							<xsl:with-param name="OPT2" select="$option2"/>
						</xsl:apply-templates>
					</tr>
				</xsl:for-each>
			</tbody>
		</table>
	</xsl:template>
	<xsl:template match="lore:Skill" mode="TD">
		<xsl:param name="OPT1"/>
		<xsl:param name="OPT2"/>
		<td>
			<xsl:value-of select="lore:Name"/>
			<xsl:choose>
				<xsl:when test="lore:Spec">(<xsl:value-of select="lore:Spec"/>)</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
		</td>
		<td>
			<strong>
				<xsl:choose>
					<xsl:when test="0>@enc_factor">
						<xsl:variable name="tmp_ratio" select="@ratio + $OPT1 + (@enc_factor * floor($OPT2))"/>
						<xsl:choose>
							<xsl:when test="0>$tmp_ratio">0</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$tmp_ratio"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:when>
					<xsl:otherwise>
						<xsl:variable name="tmp_ratio" select="@ratio + $OPT1"/>
						<xsl:choose>
							<xsl:when test="0>$tmp_ratio">0</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$tmp_ratio"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:otherwise>
				</xsl:choose>%</strong>
			<em>(<xsl:value-of select="@ratio"/>
				<xsl:choose>
					<xsl:when test="-1=@enc_factor">-ENC</xsl:when>
					<xsl:when test="-1>@enc_factor">
						<xsl:value-of select="@enc_factor"/>ENC</xsl:when>
					<xsl:otherwise/>
				</xsl:choose>%) </em>
		</td>
		<td>
			<xsl:choose>
				<xsl:when test="@exp_check='checked'"> [<em>V</em>] </xsl:when>
				<xsl:when test="@exp_check='unchecked'"> [__] </xsl:when>
				<xsl:when test="@exp_check='disable'"> ~ </xsl:when>
				<xsl:when test="@exp_check='special'"> [*]</xsl:when>
				<xsl:otherwise> [__] </xsl:otherwise>
			</xsl:choose>
		</td>
	</xsl:template>
	<xsl:template match="lore:Spell" mode="TD">
		<xsl:param name="OPT1"/>
		<xsl:param name="OPT2"/>
		<td>
			<xsl:value-of select="lore:Name"/>
			<xsl:choose>
				<xsl:when test="lore:Spec">(<xsl:value-of select="lore:Spec"/>)</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
		</td>
		<xsl:choose>
			<xsl:when test="@type='Spiritual'">
				<td>
					<xsl:if test="@strength">
						<em>‹­“x : </em>
						<xsl:value-of select="@strength"/>
					</xsl:if>
				</td>
				<td>
					<strong>
						<xsl:variable name="tmp_ratio" select="($OPT1*5) - floor($OPT2)"/>
						<xsl:choose>
							<xsl:when test="0>$tmp_ratio">0</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$tmp_ratio"/>
							</xsl:otherwise>
						</xsl:choose>%</strong>
					<em>(POW~5-ENC%) </em>
				</td>
				<td> ~ </td>
			</xsl:when>
			<xsl:when test="@type='Devine'">
				<td>
					<xsl:if test="@count">
						<em>‰ñ” : </em>
						<xsl:value-of select="@count"/>
					</xsl:if>
				</td>
				<td>
					<strong>
						<xsl:variable name="tmp_ratio" select="100 - floor($OPT2)"/>
						<xsl:choose>
							<xsl:when test="0>$tmp_ratio">0</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$tmp_ratio"/>
							</xsl:otherwise>
						</xsl:choose>%</strong>
					<em> (100-ENC%)</em>
				</td>
				<td> ~ </td>
			</xsl:when>
			<xsl:when test="@type='Magic'">
				<td>
					<strong>
						<xsl:variable name="tmp_ratio" select="@ratio - floor($OPT2)"/>
						<xsl:choose>
							<xsl:when test="0>$tmp_ratio">0</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$tmp_ratio"/>
							</xsl:otherwise>
						</xsl:choose>%</strong>
					<em> (<xsl:value-of select="@ratio"/>-ENC%)</em>
				</td>
				<td>
					<xsl:choose>
						<xsl:when test="@exp_check='checked'"> [<em>V</em>] </xsl:when>
						<xsl:otherwise> [__] </xsl:otherwise>
					</xsl:choose>
				</td>
			</xsl:when>
			<xsl:otherwise>ƒERROR„</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Skills" mode="AttackSkill">
		<xsl:param name="ManipulationModifier"/>
		<xsl:param name="ActionModifier"/>
		<xsl:param name="DamageModifier"/>
		<xsl:param name="SRM"/>
		<xsl:param name="DEX_SRM"/>
		<xsl:variable name="SkillsNode">
			<xsl:value-of select="."/>
		</xsl:variable>
		<br/>
		<table rules="rows" frame="void" border="1">
			<tbody valign="top">
				<xsl:for-each select="lore:Skill[@type='Attack']">
					<xsl:variable name="SkillName">
						<xsl:value-of select="string(lore:Name)"/>
					</xsl:variable>
					<xsl:variable name="a_ratio" select="@ratio"/>
					<tr>
						<td>
							<em>
								<xsl:value-of select="$SkillName"/>
							</em>
						</td>
						<td>
							<em> UŒ‚% : </em>
						</td>
						<td>
							<strong>
								<xsl:value-of select="$a_ratio + $ManipulationModifier"/>%</strong>
							<em>(<xsl:value-of select="$a_ratio"/>%)</em>
						</td>
						<td>
							<em> Žó‚¯% : </em>
						</td>
						<td>
							<xsl:choose>
								<xsl:when test="ancestor::*//lore:Skill[@type='Parry' and child::lore:Name=$SkillName]">
									<xsl:variable name="p_ratio" select="ancestor::*//lore:Skill[@type='Parry' and child::lore:Name=$SkillName]/@ratio"/>
									<strong>
										<xsl:value-of select="$p_ratio + $ActionModifier"/>%</strong>
									<em>(<xsl:value-of select="$p_ratio"/>%)</em>
								</xsl:when>
								<xsl:otherwise> --%(--%)</xsl:otherwise>
							</xsl:choose>
						</td>
						<td>
							<xsl:choose>
								<xsl:when test="lore:HitSpec">
									<table class="inner">
										<tbody valign="top">
											<tr>
												<td>
													<em>(g‘Ì•Ší)</em>
												</td>
												<xsl:apply-templates select="lore:HitSpec" mode="Attack">
													<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
													<xsl:with-param name="SRM" select="$SRM"/>
												</xsl:apply-templates>
											</tr>
										</tbody>
									</table>
								</xsl:when>
								<xsl:when test="lore:ShotSpec">
									<table class="inner">
										<tbody valign="top">
											<tr>
												<td>
													<em>(g‘Ì”­ŽË•Ší)</em>
												</td>
												<xsl:apply-templates select="lore:ShotSpec" mode="Attack">
													<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
													<xsl:with-param name="DEX_SRM" select="$DEX_SRM"/>
												</xsl:apply-templates>
											</tr>
										</tbody>
									</table>
								</xsl:when>
								<xsl:when test="lore:Spec">
									<table class="inner">
										<tbody valign="top">
											<xsl:for-each select="lore:Spec">
												<xsl:apply-templates select="../../../lore:Items" mode="ListUpSpecifiedWeapon">
													<xsl:with-param name="WeaponName" select="string(.)"/>
													<xsl:with-param name="SkillName" select="$SkillName"/>
													<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
													<xsl:with-param name="SRM" select="$SRM"/>
													<xsl:with-param name="DEX_SRM" select="$DEX_SRM"/>
												</xsl:apply-templates>
											</xsl:for-each>
										</tbody>
									</table>
								</xsl:when>
							</xsl:choose>
						</td>
					</tr>
				</xsl:for-each>
			</tbody>
		</table>
	</xsl:template>
	<xsl:template name="ItemsEnumerate">
		<xsl:param name="Items_set"/>
		<xsl:choose>
			<xsl:when test="$Items_set[1]">
				<xsl:apply-templates select="$Items_set[1]" mode="Enumerate"/>
			</xsl:when>
			<xsl:otherwise> </xsl:otherwise>
		</xsl:choose>
		<xsl:choose>
			<xsl:when test="$Items_set[position() != 1]">
				<xsl:call-template name="ItemsEnumerate">
					<xsl:with-param name="Items_set" select="$Items_set[position() != 1]"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise> </xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ItemEnumerate">
		<xsl:param name="Item_set"/>
		<xsl:choose>
			<xsl:when test="$Item_set[1]">
				<xsl:apply-templates select="$Item_set[1]" mode="Enumerate"/>
			</xsl:when>
			<xsl:otherwise> </xsl:otherwise>
		</xsl:choose>
		<xsl:choose>
			<xsl:when test="$Item_set[position() != 1]">
				<xsl:call-template name="ItemEnumerate">
					<xsl:with-param name="Item_set" select="$Item_set[position() != 1]"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise> </xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Items" mode="Enumerate">
		<dl compact="compact">
			<dt> ƒAƒCƒeƒ€EƒOƒ‹[ƒv–¼: <xsl:value-of select="@name"/>
			</dt>
			<dd> (ENCŒv: <xsl:apply-templates select="." mode="ENC">
					<xsl:with-param name="enc" select="0"/>
				</xsl:apply-templates> )</dd>
			<xsl:choose>
				<xsl:when test="./lore:Item">
					<xsl:call-template name="ItemEnumerate">
						<xsl:with-param name="Item_set" select="./lore:Item"/>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
			<xsl:choose>
				<xsl:when test="./lore:Items">
					<xsl:call-template name="ItemsEnumerate">
						<xsl:with-param name="Items_set" select="./lore:Items"/>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
		</dl>
	</xsl:template>
	<xsl:template match="lore:Item" mode="Enumerate">
		<dt>
			<xsl:value-of select="lore:Name"/>
		</dt>
		<dd> enc: <xsl:apply-templates select="." mode="ENC">
				<xsl:with-param name="enc" select="0"/>
			</xsl:apply-templates>
			<xsl:choose>
				<xsl:when test="lore:Heft">
					<xsl:comment> lore:Heft</xsl:comment>
					<xsl:choose>
						<xsl:when test="lore:Heft/@n and lore:Heft/@n > 1"> (# <xsl:value-of select="lore:Heft/@n"/> ~<xsl:value-of select="lore:Heft/@enc"/> enc)</xsl:when>
						<xsl:otherwise> </xsl:otherwise>
					</xsl:choose>
					<xsl:apply-templates select="lore:HitSpec" mode="Enumerate"/> ap: <xsl:choose>
						<xsl:when test="lore:Heft/@ap">
							<xsl:value-of select="lore:Heft/@ap"/>
						</xsl:when>
						<xsl:otherwise> -- </xsl:otherwise>
					</xsl:choose>
					<xsl:if test="lore:HitSpec and lore:ShotSpec">
						<em> / </em>
					</xsl:if>
					<xsl:apply-templates select="lore:ShotSpec" mode="Enumerate"/>
				</xsl:when>
				<xsl:when test="lore:Contents">
					<xsl:comment> lore:Contents</xsl:comment>
					<xsl:value-of select="lore:Contents/lore:Name"/>
					<xsl:value-of select="lore:Contents/@quantity"/>
					<xsl:value-of select="lore:Contents/@units"/> ( <xsl:value-of select="lore:Contents/@quantity div lore:Contents/@limit * 100"/> %) ap: <xsl:choose>
						<xsl:when test="lore:Contents/@ap">
							<xsl:value-of select="lore:Contents/@ap"/>
						</xsl:when>
						<xsl:otherwise> -- </xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="lore:Quantity">
					<xsl:comment> lore:Quantity</xsl:comment>
					<xsl:value-of select="lore:Quantity/@quantity"/>
					<xsl:value-of select="lore:Quantity/@units"/> ap: <xsl:choose>
						<xsl:when test="lore:Quantity/@ap">
							<xsl:value-of select="lore:Quantity/@ap"/>
						</xsl:when>
						<xsl:otherwise> -- </xsl:otherwise>
					</xsl:choose>
				</xsl:when>
				<xsl:when test="lore:Armor">
					<xsl:comment> lore:Armor</xsl:comment>
					<xsl:variable name="SIZE_CODE">
						<xsl:choose>
							<xsl:when test="lore:Armor/@size_code">
								<xsl:value-of select="lore:Armor/@size_code"/>
							</xsl:when>
							<xsl:otherwise>0</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:text> </xsl:text>
					<xsl:choose>
						<xsl:when test="$SIZE_CODE = -1">SƒTƒCƒY</xsl:when>
						<xsl:when test="$SIZE_CODE = 0">MƒTƒCƒY</xsl:when>
						<xsl:when test="$SIZE_CODE = 1">LƒTƒCƒY</xsl:when>
						<xsl:when test="$SIZE_CODE = 2">ƒgƒƒEƒ‹ƒTƒCƒY</xsl:when>
						<xsl:otherwise>‹KŠiŠO(ƒTƒCƒYƒR[ƒh: <xsl:value-of select="$SIZE_CODE"/> )</xsl:otherwise>
					</xsl:choose>
					<br/>ƒ•”•i\¬„<ol>
						<xsl:apply-templates select="lore:Armor[1]" mode="Enumerate">
							<xsl:with-param name="enc" select="0"/>
						</xsl:apply-templates>
					</ol>
				</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
			<xsl:choose>
				<xsl:when test="lore:Items">
					<br/>
					<xsl:variable name="ItemsContentsENC">
						<xsl:apply-templates select="lore:Items" mode="ENC">
							<xsl:with-param name="enc" select="0"/>
						</xsl:apply-templates>
					</xsl:variable>ƒŽû”[•¨( <xsl:value-of select="$ItemsContentsENC div lore:Items/@limit_enc * 100"/>% )„<xsl:apply-templates select="lore:Items" mode="Enumerate"/>
				</xsl:when>
				<xsl:otherwise> </xsl:otherwise>
			</xsl:choose>
		</dd>
	</xsl:template>
	<xsl:template match="lore:Armor" mode="Enumerate">
		<xsl:variable name="SIZE_CODE">
			<xsl:choose>
				<xsl:when test="@size_code">
					<xsl:value-of select="@size_code"/>
				</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="ENC_Armor" select="ceiling(($SIZE_CODE * round(@base_enc * 0.4) * 0.5 + @base_enc) * @ratio * 100) div 100"/>
		<li> •”ˆÊ:<xsl:value-of select="string(.)"/> ‘fÞ:<xsl:value-of select="@material"/> ap:<xsl:choose>
				<xsl:when test="@ap">
					<xsl:value-of select="@ap"/>
				</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose> enc:<xsl:value-of select="$ENC_Armor"/>
		</li>
		<xsl:choose>
			<xsl:when test="following-sibling::lore:Armor[1]">
				<xsl:apply-templates select="following-sibling::lore:Armor[1]" mode="Enumerate"/>
			</xsl:when>
			<xsl:otherwise> </xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:HitSpec" mode="Enumerate"> (‹ßÚ) Šî–{%: <xsl:value-of select="@basic_rate"/>% ƒ_ƒ[ƒW: <xsl:value-of select="@damage"/> SR: <xsl:value-of select="@sr"/>
		<xsl:if test="lore:AttackCondition"> (ðŒ: <xsl:value-of select="lore:AttackCondition"/> )</xsl:if>
	</xsl:template>
	<xsl:template match="lore:ShotSpec" mode="Enumerate">
		<xsl:choose>
			<xsl:when test="lore:Missile"> i”­ŽË: <xsl:value-of select="lore:Missile"/> j</xsl:when>
			<xsl:otherwise> i“ŠŽ®j</xsl:otherwise>
		</xsl:choose> Šî–{%: <xsl:value-of select="@basic_rate"/>% ƒ_ƒ[ƒW: <xsl:value-of select="@damage"/> ŽË—¦: 1/<xsl:if test="@interval !=1 ">
			<xsl:value-of select="@interval"/>
		</xsl:if>
		<xsl:value-of select="@unit"/> ŽË’ö: <xsl:value-of select="@range"/>m/<xsl:value-of select="@max_range"/>m<xsl:if test="lore:AttackCondition"> (ðŒ: <xsl:value-of select="lore:AttackCondition"/> ) </xsl:if>
	</xsl:template>
	<xsl:template name="ItemsSearchAP">
		<xsl:param name="Items_set"/>
		<xsl:param name="part_name"/>
		<xsl:param name="ap"/>
		<xsl:variable name="AP_Items_1st">
			<xsl:choose>
				<xsl:when test="$Items_set[1]">
					<xsl:apply-templates select="$Items_set[1]" mode="AP">
						<xsl:with-param name="part_name" select="$part_name"/>
						<xsl:with-param name="ap" select="$ap"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$ap"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- <xsl:message> group name: <xsl:value-of select="$Items_set[1]/@name"/> ap: <xsl:value-of select="$AP_Items_1st"/>
		</xsl:message>
		 -->
		<xsl:choose>
			<xsl:when test="$Items_set[position() != 1]">
				<xsl:call-template name="ItemsSearchAP">
					<xsl:with-param name="Items_set" select="$Items_set[position() != 1]"/>
					<xsl:with-param name="part_name" select="$part_name"/>
					<xsl:with-param name="ap" select="$AP_Items_1st"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$AP_Items_1st"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ItemSearchAP">
		<xsl:param name="Item_set"/>
		<xsl:param name="part_name"/>
		<xsl:param name="ap"/>
		<xsl:variable name="AP_Item_1st">
			<xsl:choose>
				<xsl:when test="$Item_set[1]">
					<xsl:apply-templates select="$Item_set[1]" mode="AP">
						<xsl:with-param name="part_name" select="$part_name"/>
						<xsl:with-param name="ap" select="$ap"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$ap"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- <xsl:message> name: <xsl:value-of select="$Item_set[1]/lore:Name"/> given ap: <xsl:value-of select="$ap"/> ap: <xsl:value-of select="$AP_Item_1st"/>
		</xsl:message>
		 -->
		<xsl:choose>
			<xsl:when test="$Item_set[position() != 1]">
				<xsl:call-template name="ItemSearchAP">
					<xsl:with-param name="Item_set" select="$Item_set[position() != 1]"/>
					<xsl:with-param name="part_name" select="$part_name"/>
					<xsl:with-param name="ap" select="$AP_Item_1st"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$AP_Item_1st"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Items" mode="AP">
		<xsl:param name="part_name"/>
		<xsl:param name="ap"/>
		<xsl:variable name="AP_Items_set">
			<xsl:choose>
				<xsl:when test="./lore:Items">
					<xsl:call-template name="ItemsSearchAP">
						<xsl:with-param name="Items_set" select="./lore:Items"/>
						<xsl:with-param name="part_name" select="$part_name"/>
						<xsl:with-param name="ap" select="$ap"/>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$ap"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="./lore:Item[@equipped and @equipped = 'true']">
				<xsl:call-template name="ItemSearchAP">
					<xsl:with-param name="Item_set" select="./lore:Item"/>
					<xsl:with-param name="part_name" select="$part_name"/>
					<xsl:with-param name="ap" select="$AP_Items_set"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$AP_Items_set"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Item" mode="AP">
		<xsl:param name="part_name"/>
		<xsl:param name="ap"/>
		<xsl:variable name="AP_Self">
			<xsl:choose>
				<xsl:when test="lore:Armor">
					<xsl:apply-templates select="lore:Armor[1]" mode="AP">
						<xsl:with-param name="part_name" select="$part_name"/>
						<xsl:with-param name="ap" select="0"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- <xsl:message> (Item)given ap: <xsl:value-of select="$ap"/> raw Item ap: <xsl:value-of select="$AP_Self"/>
		</xsl:message>
		 -->
		<xsl:value-of select="$AP_Self + $ap"/>
	</xsl:template>
	<xsl:template match="lore:Armor" mode="AP">
		<xsl:param name="part_name"/>
		<xsl:param name="ap"/>
		<xsl:variable name="AP_Armor">
			<xsl:choose>
				<xsl:when test="$part_name = string(.) and @ap">
					<!-- <xsl:message> (Armor) name: <xsl:value-of select="string(.)"/> requested name: <xsl:value-of select="$part_name"/> given ap: <xsl:value-of select="$ap"/> this parts ap: <xsl:value-of select="@ap"/>
					</xsl:message>
					 -->
					<xsl:value-of select="@ap + $ap"/>
				</xsl:when>
				<xsl:otherwise>
					<!-- <xsl:message> (Armor) name: <xsl:value-of select="string(.)"/> requested name: <xsl:value-of select="$part_name"/> given ap: <xsl:value-of select="$ap"/> this parts dose not have requested AP</xsl:message>
					 -->
					<xsl:value-of select="$ap"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="following-sibling::lore:Armor[1]">
				<xsl:apply-templates select="following-sibling::lore:Armor[1]" mode="AP">
					<xsl:with-param name="part_name" select="$part_name"/>
					<xsl:with-param name="ap" select="$AP_Armor"/>
				</xsl:apply-templates>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$AP_Armor"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ItemsSetENC">
		<xsl:param name="Items_set"/>
		<xsl:param name="enc"/>
		<xsl:variable name="ENC_Items_1st">
			<xsl:choose>
				<xsl:when test="$Items_set[1]">
					<xsl:apply-templates select="$Items_set[1]" mode="ENC">
						<xsl:with-param name="enc" select="$enc"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$enc"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- <xsl:comment> group name: <xsl:value-of select="$Items_set[1]/@name"/> enc: <xsl:value-of select="$ENC_Items_1st"/>
		</xsl:comment> -->
		<xsl:choose>
			<xsl:when test="$Items_set[position() != 1]">
				<xsl:call-template name="ItemsSetENC">
					<xsl:with-param name="Items_set" select="$Items_set[position() != 1]"/>
					<xsl:with-param name="enc" select="$ENC_Items_1st"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$ENC_Items_1st"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="ItemSetENC">
		<xsl:param name="Item_set"/>
		<xsl:param name="enc"/>
		<xsl:variable name="ENC_Item_1st">
			<xsl:choose>
				<xsl:when test="$Item_set[1]">
					<xsl:apply-templates select="$Item_set[1]" mode="ENC">
						<xsl:with-param name="enc" select="$enc"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$enc"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- <xsl:message> name: <xsl:value-of select="$Item_set[1]/lore:Name"/> enc: <xsl:value-of select="$ENC_Item_1st"/>
		</xsl:message> -->
		<xsl:choose>
			<xsl:when test="$Item_set[position() != 1]">
				<xsl:call-template name="ItemSetENC">
					<xsl:with-param name="Item_set" select="$Item_set[position() != 1]"/>
					<xsl:with-param name="enc" select="$ENC_Item_1st"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$ENC_Item_1st"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Items" mode="ENC">
		<xsl:param name="enc"/>
		<xsl:variable name="ENC_Items_set">
			<xsl:choose>
				<xsl:when test="./lore:Items">
					<xsl:call-template name="ItemsSetENC">
						<xsl:with-param name="Items_set" select="./lore:Items"/>
						<xsl:with-param name="enc" select="$enc"/>
					</xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="$enc"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:choose>
			<xsl:when test="./lore:Item">
				<xsl:call-template name="ItemSetENC">
					<xsl:with-param name="Item_set" select="./lore:Item"/>
					<xsl:with-param name="enc" select="$ENC_Items_set"/>
				</xsl:call-template>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$ENC_Items_set"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Item" mode="ENC">
		<xsl:param name="enc"/>
		<xsl:variable name="ENC_Items">
			<xsl:choose>
				<xsl:when test="lore:Items">
					<xsl:variable name="Pure_ENC_Items">
						<xsl:apply-templates select="lore:Items" mode="ENC">
							<xsl:with-param name="enc" select="0"/>
						</xsl:apply-templates>
					</xsl:variable>
					<xsl:value-of select="ceiling(($Pure_ENC_Items * lore:Items/@std_enc div lore:Items/@limit_enc)*100) div 100"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="ENC_Content">
			<xsl:choose>
				<xsl:when test="lore:Heft">
					<xsl:variable name="N">
						<xsl:choose>
							<xsl:when test="lore:Heft/@n">
								<xsl:value-of select="lore:Heft/@n"/>
							</xsl:when>
							<xsl:otherwise>1</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<xsl:value-of select="lore:Heft/@enc * $N"/>
				</xsl:when>
				<xsl:when test="lore:Contents">
					<xsl:value-of select="ceiling(((lore:Contents/@quantity * (lore:Contents/@std_enc - lore:Contents/@empty_enc) + lore:Contents/@limit * lore:Contents/@empty_enc) div lore:Contents/@limit)*100) div 100"/>
				</xsl:when>
				<xsl:when test="lore:Quantity">
					<xsl:value-of select="ceiling((lore:Quantity/@quantity * lore:Quantity/@std_enc div lore:Quantity/@std)*100) div 100"/>
				</xsl:when>
				<xsl:when test="lore:Armor">
					<xsl:apply-templates select="lore:Armor[1]" mode="ENC">
						<xsl:with-param name="enc" select="0"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- <xsl:message> raw Item enc: <xsl:value-of select="$ENC_Content"/>
		</xsl:message> -->
		<xsl:value-of select="ceiling(($ENC_Content + $ENC_Items + $enc) * 100) div 100"/>
	</xsl:template>
	<xsl:template match="lore:Armor" mode="ENC">
		<xsl:param name="enc"/>
		<xsl:variable name="SIZE_CODE">
			<xsl:choose>
				<xsl:when test="@size_code">
					<xsl:value-of select="@size_code"/>
				</xsl:when>
				<xsl:otherwise>0</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="ENC_Armor" select="ceiling(($SIZE_CODE * round(@base_enc * 0.4) * 0.5 + @base_enc) * @ratio * 100) div 100 + $enc"/>
		<xsl:choose>
			<xsl:when test="following-sibling::lore:Armor[1]">
				<xsl:apply-templates select="following-sibling::lore:Armor[1]" mode="ENC">
					<xsl:with-param name="enc" select="$ENC_Armor"/>
				</xsl:apply-templates>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$ENC_Armor"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template match="lore:Items" mode="ListUpSpecifiedWeapon">
		<xsl:param name="WeaponName"/>
		<xsl:param name="SkillName"/>
		<xsl:param name="DamageModifier"/>
		<xsl:param name="SRM"/>
		<xsl:param name="DEX_SRM"/>
		<xsl:comment>
			<xsl:text>Items</xsl:text>
			<xsl:text> / SerchingWeaponName: </xsl:text>
			<xsl:value-of select="$WeaponName"/>
		</xsl:comment>
		<xsl:apply-templates select="lore:Item[lore:Name = $WeaponName]" mode="SpecifiedWeapon">
			<xsl:with-param name="SkillName" select="$SkillName"/>
			<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
			<xsl:with-param name="SRM" select="$SRM"/>
			<xsl:with-param name="DEX_SRM" select="$DEX_SRM"/>
		</xsl:apply-templates>
		<xsl:apply-templates select="lore:Items | lore:Item/lore:Items" mode="ListUpSpecifiedWeapon">
			<xsl:with-param name="WeaponName" select="$WeaponName"/>
			<xsl:with-param name="SkillName" select="$SkillName"/>
			<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
			<xsl:with-param name="SRM" select="$SRM"/>
			<xsl:with-param name="DEX_SRM" select="$DEX_SRM"/>
		</xsl:apply-templates>
	</xsl:template>
	<xsl:template match="lore:Item" mode="SpecifiedWeapon">
		<xsl:param name="SkillName"/>
		<xsl:param name="DamageModifier"/>
		<xsl:param name="SRM"/>
		<xsl:param name="DEX_SRM"/>
		<xsl:comment>
			<xsl:text>Item: </xsl:text>
			<xsl:value-of select="lore:Item/lore:Name"/>
		</xsl:comment>
		<tr>
			<td>
				<xsl:if test="@equipped = 'true'">
					<strong> *</strong>
				</xsl:if>
				<xsl:choose>
					<xsl:when test="lore:UniqueName">
						<xsl:value-of select="lore:UniqueName"/>
						<br/>(<xsl:value-of select="lore:Name"/>)</xsl:when>
					<xsl:otherwise>
						<xsl:value-of select="lore:Name"/>
					</xsl:otherwise>
				</xsl:choose>
			</td>
			<xsl:choose>
				<xsl:when test="lore:HitSpec/@category = $SkillName">
					<xsl:apply-templates select="lore:HitSpec" mode="Attack">
						<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
						<xsl:with-param name="SRM" select="$SRM"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:when test="lore:ShotSpec/@category = $SkillName">
					<xsl:apply-templates select="lore:ShotSpec" mode="Attack">
						<xsl:with-param name="DamageModifier" select="$DamageModifier"/>
						<xsl:with-param name="DEX_SRM" select="$DEX_SRM"/>
					</xsl:apply-templates>
				</xsl:when>
				<xsl:otherwise>
					<td colspan="4">(This Item is not a weapon.)</td>
				</xsl:otherwise>
			</xsl:choose>
			<td>
				<em> AP: </em>
			</td>
			<td>
				<strong>
					<xsl:value-of select="lore:Heft/@ap"/>
				</strong>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="lore:HitSpec" mode="Attack">
		<xsl:param name="DamageModifier"/>
		<xsl:param name="SRM"/>
		<td>
			<em> ƒ_ƒ[ƒW: </em>
		</td>
		<td>
			<strong>
				<xsl:value-of select="@damage"/>
				<xsl:value-of select="$DamageModifier"/>
			</strong>
		</td>
		<td>
			<em> SR: </em>
		</td>
		<td>
			<strong>
				<xsl:value-of select="@sr + $SRM"/>
			</strong>
			<em>(<xsl:value-of select="@sr"/>)</em>
		</td>
		<td>
			<xsl:value-of select="lore:AttackCondition"/>
		</td>
	</xsl:template>
	<xsl:template match="lore:ShotSpec" mode="Attack">
		<xsl:param name="DamageModifier"/>
		<xsl:param name="DEX_SRM"/>
		<td>
			<em> ƒ_ƒ[ƒW: </em>
		</td>
		<td>
			<strong>
				<xsl:value-of select="@damage"/>
				<xsl:value-of select="$DamageModifier"/>
				<xsl:if test="not(lore:Missile)">/2</xsl:if>
			</strong>
		</td>
		<td>
			<em> SR: </em>
		</td>
		<td>
			<strong>
				<xsl:value-of select="$DEX_SRM"/>
			</strong>
		</td>
		<td>
			<em> ŽË—¦: </em>
		</td>
		<td>
			<strong>
				1/<xsl:if test="@interval !=1 ">
					<xsl:value-of select="@interval"/>
				</xsl:if>
				<xsl:value-of select="@unit"/>
			</strong>
		</td>
		<td>
			<em> ŽË’ö: </em>
		</td>
		<td>
			<strong>
				<xsl:value-of select="@range"/>
			</strong>
			<em>m/</em>
			<strong>
				<xsl:value-of select="@max_range"/>
			</strong>
			<em>m</em>
		</td>
		<td>
			<xsl:value-of select="lore:AttackCondition"/>
		</td>
	</xsl:template>
</xsl:stylesheet>

