<?xml version="1.0" ?>
<!-- Pretty Printer for the Schematron XML Schema Language.
	http://www.ascc.net/xml/resource/schematron/schematron.html

 Copyright (c) 1999 Rick Jelliffe and Academia Sinica Computing Center, Taiwan

 This software is provided 'as-is', without any express or implied warranty. 
 In no event will the authors be held liable for any damages arising from 
 the use of this software.

 Permission is granted to anyone to use this software for any purpose, 
 including commercial applications, and to alter it and redistribute it freely,
 subject to the following restrictions:

 1. The origin of this software must not be misrepresented; you must not claim
 that you wrote the original software. If you use this software in a product, 
 an acknowledgment in the product documentation would be appreciated but is 
 not required.

 2. Altered source versions must be plainly marked as such, and must not be 
 misrepresented as being the original software.

 3. This notice may not be removed or altered from any source distribution.
    1999-11-2 Created Rick Jelliffe
	CSS ideas borrowed from Dr Nic's Schematron tutorial format.
    1999-11-5 Beta for DTD 1.2
    1999-12-26 Add code for namespace
	
-->
<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >

<!-- Category: top-level-element -->
<xsl:output
  method="html" 
  indent="yes" />

<xsl:template match="schema">
<html><title><xsl:value-of select="title"/></title>
<style type="text/css">
A:onmouseover { color:#FF0080; }
A:visited { color:#003399; }
TD.titlebar1
{
    BACKGROUND-COLOR: #404040;
    COLOR: #1043B9;
    FONT-SIZE: 0.8em;
    FONT-WEIGHT: bold;
    TEXT-ALIGN: right;
}
TD.titlebar2
{
    BACKGROUND-COLOR: #1043C9;
    COLOR: #003399;
    FONT-SIZE: 0.8em;
    FONT-WEIGHT: bold;
    TEXT-ALIGN: right;
}
TD.titlebar3
{
    BACKGROUND-COLOR: #1043C9;
    COLOR: #003399;
    FONT-SIZE: 0.8em;
    FONT-WEIGHT: bold;
    TEXT-ALIGN: right;
}
TH.titlebar1
{
    BACKGROUND-COLOR: #404040;
    COLOR: #003399;
    FONT-SIZE: 0.9em;
    FONT-WEIGHT: bold;
    TEXT-ALIGN: left;
}
TH.titlebar2
{
    BACKGROUND-COLOR: #1043C9;
    COLOR: #003399;
    FONT-SIZE: 0.9em;
    FONT-WEIGHT: bold;
    TEXT-ALIGN: left;
}
TH.titlebar3
{
    BACKGROUND-COLOR: #1043C9;
    COLOR: #003399;
    FONT-SIZE: 0.9em;
    FONT-WEIGHT: bold;
    TEXT-ALIGN: left;
}
SPAN.titlebar
{
    BACKGROUND-COLOR: white;
    COLOR:#003399;
}
</style>
<body> 
<h2 title="Schematron contact-information is at the end of this page">
<font color="#FF0080">Schematron</font> Pretty</h2>
	<xsl:apply-templates />
<hr color="#FF0080" />
<p>
<font size="2">Schematron Pretty by Rick Jelliffe.  
<a href="http://www.ascc.net/xml/resource/schematron/schematron.html" title="Link to the home page of the Schematron, a tree-pattern schema language"><font color="#FF0080">The Schematron</font></a> by 
	<a href="mailto:ricko@gate.sinica.edu.tw" title="Email to Rick Jelliffe (pronounced RIK JELIF)">Rick Jelliffe</a>,
	<a href="http://www.sinica.edu.tw" title="Link to home page of Academia Sinica">Academia Sinica Computing Centre</a>. 
</font>
</p>
</body>
</html>
</xsl:template>

<xsl:template match="title">
	<h1><xsl:apply-templates /></h1>
	<xsl:if test="../@ns"><h3 ><xsl:value-of select="../@ns"/></h3></xsl:if>
	<xsl:if test="../@fpi"><h3><i><xsl:value-of select="../@fpi"/></i></h3></xsl:if>

                <xsl:for-each select="ns">
		xmlns:<b><xsl:value-of select="@prefix"/></b>=
		"<xsl:value-of select="@uri"/>"<br />
			
                </xsl:for-each>
</xsl:template>

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

<xsl:template match="emph">
<tt><xsl:apply-templates/></tt>
</xsl:template>

<xsl:template match="span">
<span class="{@class}"><xsl:apply-templates/></span>
</xsl:template>

<xsl:template match="pattern">
<TABLE width='100%' border='0' cellspacing='0'>
<TR><TH class='titlebar1'><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text
><SPAN class='titlebar'><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;</xsl:text>Pattern<xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;</xsl:text></SPAN></TH> <TD class='titlebar1'>
<SPAN class='titlebar' title="id" ><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;</xsl:text><span style="color:red"><xsl:value-of select="@id"/></span
><xsl:text disable-output-escaping="yes"
>&amp;nbsp;</xsl:text><i><xsl:value-of select="@fpi"/></i><xsl:text disable-output-escaping="yes"
>&amp;nbsp;</xsl:text></SPAN><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;</xsl:text>
<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text></TD></TR>
</TABLE>
	<h2 title="name"><xsl:value-of select="@name"/></h2>
	<xsl:if test="@see">
		<p>For documentation, please refer to <a href="@see"><xsl:value-of select="@see"/></a></p>
	</xsl:if>
<div align="right">
<TABLE rules="none" frame="below"  border="1" cellspacing='0' width="95%" >
	<xsl:apply-templates />
</TABLE>
</div>
<br />
<br />
<br />
</xsl:template>

<xsl:template match="rule">
<TR><TH class='titlebar2' colspan="3"><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text
><SPAN class='titlebar'><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;Rule </xsl:text>
<SPAN style="color:red"><xsl:value-of select="@role"/></SPAN>
<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text></SPAN></TH></TR>
	<tr><TD rowspan='{(count(*) *2) + 1}' title="rule context" style="width:20%" ><tt><xsl:value-of select="@context"/></tt>
	</TD></tr>
	<xsl:apply-templates />
</xsl:template>

<xsl:template match="assert">
<tr>
<TH class='titlebar3' colspan="2"><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text
><SPAN class='titlebar'><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;Assert </xsl:text>
<SPAN  title="assert role" style="color:red">
<xsl:value-of select="@role" />
</SPAN>
<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text></SPAN></TH>
</tr>
<tr>
<TD title="assert test"><tt><xsl:value-of select="@test"/></tt>
	</TD><TD title="assert " ><xsl:apply-templates /></TD>
	</tr>
</xsl:template>

<xsl:template match="key">
<tr>
<TH class='titlebar3' colspan="2"><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text
><SPAN class='titlebar'><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;Key </xsl:text>
<SPAN  title="key name" style="color:red"><xsl:value-of select="@name" /></SPAN>
<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text></SPAN></TH>
</tr>
<tr>
<TD title="key path"><tt><xsl:value-of select="@path"/></tt>
	</TD><TD><xsl:apply-templates /></TD>
	</tr>
</xsl:template>

<xsl:template match="report">
<tr>
<TH class='titlebar3' colspan="2"><xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;&amp;nbsp;</xsl:text
><SPAN class='titlebar'><xsl:text disable-output-escaping="yes"
>&amp;nbsp;&amp;nbsp;Report </xsl:text>
<SPAN  title="report role" style="color:red"><xsl:value-of select="@role" /></SPAN>
<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text></SPAN></TH>
</tr>
<tr>
<TD title="report test"><tt><xsl:value-of select="@test"/></tt>
	</TD><TD title="report" style="width:50%"><xsl:apply-templates /></TD>
<TD >
	</TD>
	</tr>
</xsl:template>

<xsl:template match="name">
	<tt title="name">&lt;name path="<b><xsl:value-of select="@path"/></b>"/&gt;</tt>
</xsl:template>

</xsl:stylesheet>
