<!-- 
XSL stylesheet to format TEI XML documents to HTML

Many basic ideas and many details taken from the stylesheets
written by Sebastian Rahtz. I gratefully reproduce his copyright statement:

 Copyright 1999 Sebastian Rahtz/Oxford University  <sebastian.rahtz@oucs.ox.ac.uk>

 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and any associated documentation files (the
 ``Software''), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
 
 The above copyright notice and this permission notice shall be included
 in all copies or substantial portions of the Software.
--> 
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0">

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

<xsl:template match="p[@rend='display']">
 <blockquote>
  <xsl:apply-templates/>
 </blockquote>
</xsl:template>

<!-- lines, linegroups, line breaks -->
<xsl:template match="lb">
 <br/>
</xsl:template>

<xsl:template match="l">
	<xsl:if test="@id">
		<a name="{@id}"></a>
	</xsl:if>
	<xsl:apply-templates/>
	<xsl:call-template name="linkMaken">
		<xsl:with-param name="identifier" select="@id"/>
	</xsl:call-template>
	<br/>
</xsl:template>

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

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

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

<xsl:template match="byline">
    <center><b><xsl:apply-templates/></b></center>
</xsl:template>

<xsl:template match="lg">
	<xsl:if test="@id">
		<a name="{@id}"></a>
	</xsl:if>
	<xsl:choose>
		<xsl:when test="@rend">
			<xsl:call-template name="rendering"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:apply-templates/>
		</xsl:otherwise>
	</xsl:choose>
	<xsl:call-template name="linkMaken">
		<xsl:with-param name="identifier" select="@id"/>
	</xsl:call-template>
</xsl:template>

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

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

<!-- tables -->
<xsl:template match="table">
 <div align="center">
 <table>
 <xsl:apply-templates/>
 </table>
 </div>
</xsl:template>

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

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

</xsl:stylesheet>

