
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:saxon="http://icl.com/saxon"  
                extension-element-prefixes="saxon"
                version="1.0">


<xsl:import href="9573common.xsl"/>
<xsl:param name="glyphsbase"
select="'../'"/>

<xsl:output method="html"/>

<xsl:template match="document">
<saxon:output href="../iso9573-2003doc/9573.html">
<html>
<head>
<title><xsl:value-of select="head/title"/></title>
</head>
<body>
<p>ISO/IEC DTR 9573-13 2nd Ed.</p>
<hr/>

<h1><xsl:apply-templates mode="doc" select="head/title/node()"/></h1>
<h2><xsl:apply-templates mode="doc" select="head/subtitle/node()"/></h2>

<div><xsl:for-each select="head/author">
<xsl:apply-templates mode="doc" select="node()"/>
<xsl:if test="position()&lt;last()"> and </xsl:if>
</xsl:for-each>
</div>

<div>
<xsl:apply-templates mode="doc" select="head/date/node()"/>
</div>

<h2>Table of Contents</h2>
<xsl:for-each select="section">
<xsl:variable name="p" select="position()"/>
<a href="9573sec{$p}.html">
  <xsl:value-of select="$p"/>&#160;<xsl:apply-templates mode="doc" select="head/node()"/>
</a><br/>
<xsl:for-each select="section">
&#160;&#160;&#160;&#160;<a href="9573sec{$p}.html#sec{$p}.{position()}">
 <xsl:value-of select="$p"/>.<xsl:value-of select="position()"
     />&#160;<xsl:apply-templates mode="doc" select="head/node()"/></a><br/>
</xsl:for-each>
<xsl:if test="position()=last()">
<xsl:for-each select="$sets">
<xsl:sort select="@name"/>
&#160;&#160;&#160;&#160;<a
href="9573sec{$p}-{position()}.html">
  <xsl:value-of select="@name"/></a><br/>
</xsl:for-each>
</xsl:if>
</xsl:for-each>


<xsl:apply-templates  mode="doc"/>
</body>
</html>
</saxon:output>
</xsl:template>


<xsl:template match="document" mode="doc">
<xsl:apply-templates mode="doc"/>
</xsl:template>

<xsl:template match="head" mode="doc"/>

<xsl:template match="document/section" mode="doc">
<xsl:variable name="p" select="count(preceding-sibling::section)+1"/>
<saxon:output href="../iso9573-2003doc/9573sec{$p}.html">
<html>
<head>
</head>
<body>
<div>
<a href="9573.html">Up</a><br/>
<xsl:if test="preceding-sibling::section">
<a href="9573sec{$p - 1}.html">Previous</a><br/>
</xsl:if>
<xsl:if test="following-sibling::section">
<a href="9573sec{$p + 1}.html">Next</a><br/>
</xsl:if>
<a href="#sec{$p}"><xsl:apply-templates mode="doc" select="head/node()"/></a><br/>
<xsl:for-each select="section">
&#160;&#160;&#160;&#160;<a href="#sec{$p}.{position()}">
 <xsl:apply-templates mode="doc"
select="head/node()"/></a><br/>
</xsl:for-each>
<xsl:if test="not(following-sibling::section)">
<xsl:for-each select="$sets">
<xsl:sort select="@name"/>
&#160;&#160;&#160;&#160;<a
href="9573sec{$p}-{position()}.html">
  <xsl:value-of select="@name"/></a><br/>
</xsl:for-each>
</xsl:if>

</div>
<hr/>
<xsl:apply-templates mode="doc"/>
</body>
</html>
</saxon:output>
</xsl:template>

<xsl:template match="section" mode="doc">
<xsl:apply-templates mode="doc"/>
</xsl:template>

<xsl:template match="section/head" mode="doc">
<xsl:variable name="p"  select="count(../preceding-sibling::section)+1"/>
<h2 id="sec{$p}"><xsl:value-of select="$p"/>&#160;<xsl:apply-templates mode="doc"/></h2>
</xsl:template>

<xsl:template match="section/section/head" mode="doc" priority="2">
<xsl:variable name="p1"  select="count(../../preceding-sibling::section)+1"/>
<xsl:variable name="p2"  select="count(../preceding-sibling::section)+1"/>
<h3 id="sec{$p1}.{$p2}">
<xsl:value-of select="$p1"/>.<xsl:value-of select="$p2"/>
<xsl:text>&#160;</xsl:text>
<xsl:apply-templates mode="doc"/></h3>
</xsl:template>

<xsl:template match="p" mode="doc">
<p>
<xsl:apply-templates mode="doc"/>
</p>
</xsl:template>


<xsl:template match="note" mode="doc">
<blockquote style="fontstyle:italic">
Note <xsl:number level="any"/>:
<xsl:apply-templates mode="doc"/>
</blockquote>
</xsl:template>

<xsl:template match="pre" mode="doc">
<pre>
<xsl:apply-templates mode="doc"/>
</pre>
</xsl:template>

<xsl:template match="code" mode="doc">
<code><xsl:apply-templates mode="doc"/></code>
</xsl:template>

<xsl:template match="br" mode="doc">
<br/>
</xsl:template>

<xsl:template match="ul" mode="doc">
<ul>
<xsl:apply-templates mode="doc"/>
</ul>
</xsl:template>


<xsl:template match="li" mode="doc">
<li>
<xsl:apply-templates mode="doc"/>
</li>
</xsl:template>

<xsl:template match="uri" mode="doc">
<a href="{.}"><xsl:apply-templates mode="doc"/></a>
</xsl:template>

<xsl:template match="quote" mode="doc">
<xsl:text/>"<xsl:apply-templates mode="doc"/>"<xsl:text/>
</xsl:template>

<xsl:template match="i" mode="doc">
<i><xsl:apply-templates mode="doc"/></i>
</xsl:template>





<xsl:template match="charactertables" mode="doc">
<xsl:variable name="p" select="count(../preceding-sibling::section)+1"/>
<xsl:variable name="sub" select="count(ancestor::section)"/>

<xsl:for-each select="$u">

<xsl:for-each select="$sets">
<xsl:sort select="@name"/>
<xsl:variable name="n" select="substring(@name,11)"/>

<saxon:output href="../iso9573-2003doc/9573sec{$p}-{position()}.html">
<html>
<head>
<title><xsl:value-of select="$n"/></title>
</head>
<body>
<div>
<a href="9573sec{$p}.html">Up</a><br/>
<xsl:if test="position()&gt;1">
<a href="9573sec{$p}-{position() - 1}.html">Previous</a><br/>
</xsl:if>
<xsl:if test="position()&lt;last()">
<a href="9573sec{$p}-{position() + 1}.html">Next</a><br/>
</xsl:if>
</div>
<hr/>

<xsl:element name="h{1+$sub}"><xsl:value-of select="$n"/></xsl:element>

<table>
<thead>
<tr>
<th>Entity Name</th>
<th>Unicode/10646</th>
<th>Glyph image</th>
<th>Character Description<br/> ISO Unicode/10646 Name</th>
</tr>
</thead>
<tbody>
<xsl:for-each select="key('set',@name)">
<xsl:sort select="@id"/>
<tr>
<td><xsl:value-of select="@id"/></td>
<td><xsl:value-of select="substring-after(../@id,'U')"/></td>
<td><img>
<xsl:attribute name="src">
  <xsl:value-of select="$glyphsbase"/>glyphs/<xsl:choose>
<xsl:when test="../@image='none'">none</xsl:when>
<xsl:otherwise>
 <xsl:value-of select="substring(../@id,2,3)"/>/<xsl:value-of
 select="translate(../@id,'x','')"/>
 </xsl:otherwise>
 </xsl:choose>.png</xsl:attribute>
 </img></td>
<td><xsl:value-of select="desc"/><br/>
<xsl:value-of select="../description"/></td>
</tr>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</saxon:output>
</xsl:for-each>

</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
