<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">

<xsl:template match="cgm">
	<html>
		<head>
			<title><xsl:value-of select="header/title" /></title>
			<style>
				body     { background-color: #FFFFFF }
				.level1  { margin-left : 1em }
                                table    { background-color: #CCCCCC } 
			</style>
		</head>
		<body>
			<xsl:apply-templates/>
		</body>
	</html>
</xsl:template>

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

<xsl:template match="title">
	<h1 align="center">
		<xsl:apply-templates/>
	</h1>
</xsl:template>

<xsl:template match="verb">
	<div class="level1">
		<xsl:apply-templates/>
	</div><hr/>
</xsl:template>

<xsl:template match="verbHead">
	<h2 align="center">
		<xsl:apply-templates/>
	</h2>
</xsl:template>

<xsl:template match="verbName">
	<b>Verb name: </b>
		<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="verbVersion">
	<b>Verb version: </b>
		<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="verbDate">
	<b>Modification Date: </b>
		<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="reqArgs">
	<b>Required arguments: </b>
		<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="optArgs">
	<b>Optional arguments: </b>
		<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="mimetype">
	<b>MIMETYPE of response: </b>
		<xsl:apply-templates/>
	<br/>
</xsl:template>

<xsl:template match="verbDesc">
	<h3>Verb Description</h3>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="arguments">
	<h3>Arguments</h3>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="responseDesc">
	<h3>Response</h3>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="errorCodes">
	<h3>Error Codes</h3>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="examples">
	<h3>Examples</h3>
	<xsl:apply-templates/>
</xsl:template> 

<xsl:template match="request">
	<h4><i>Request</i></h4>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="response">
	<h4><i>Response</i></h4>
	<xsl:apply-templates/>
</xsl:template>

<xsl:template match="requestEx">
	<pre><xsl:value-of select="." /></pre>
</xsl:template>

<xsl:template match="responseEx">
	<table cellPadding="0" width="650" border="1"><tbody><tr>
	<td><pre><xsl:value-of select="." /></pre></td>
	</tr></tbody></table>
</xsl:template>

<xsl:template match="history">
	<h3>Verb History</h3>
	<xsl:apply-templates/>
</xsl:template>

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

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

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

<xsl:template match="tt">
	<tt><xsl:value-of select="." /></tt>
</xsl:template>

<xsl:template match="i">
	<i><xsl:value-of select="." /></i>
</xsl:template>

<xsl:template match="b">
	<b><xsl:value-of select="." /></b>
</xsl:template>

<xsl:template match="a">
	<a>
		<xsl:if test="@href">
		<xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:value-of select="." />
		</xsl:if>
		<xsl:if test="@name">
		<xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute><xsl:value-of select="." />
		</xsl:if>
	</a>
</xsl:template>

<xsl:template match="term">
	<b><tt><xsl:value-of select="." /></tt></b>
	<xsl:text> :: </xsl:text>
</xsl:template> 

<xsl:template match="element">
	<b><tt>&lt;<xsl:value-of select="." />&gt;</tt></b>
	<xsl:text> :: </xsl:text>
</xsl:template> 

</xsl:stylesheet>
