<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:preserve-space elements="*"/>
    <!-- all the &#160; stuff enable whitespacing somehow; surely a hack that has a better solution -->

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

    <xsl:template match="div[contains(@style,'text-align: center;')]">&#160;
<center>&#160;
<xsl:apply-templates/>
</center>&#160;
</xsl:template>

    <xsl:template match="div[contains(@style,'text-align: left;')]">&#160;
<div style="text-align: left;">&#160;
<xsl:apply-templates/>
</div>&#160;
</xsl:template>

    <xsl:template match="pre">&#160;
<pre>
<xsl:apply-templates/>
</pre>&#160;
</xsl:template>

    
    <xsl:template match="br">

</xsl:template>

    <!-- go from beastly towards light, in order of appearance, or we'll ignore some style somewhere -->

    <!-- bold, italic, and underline; they sure mean business! -->
    <xsl:template priority="3.0" match="span[contains(@style,'font-style: italic;') and contains(@style, 'text-decoration: underline;') and contains(@style, 'font-weight: bold;')]"><u>''''<xsl:apply-templates/>''''</u></xsl:template>

    <!-- bold and italic -->
    <xsl:template priority="2.0" match="span[contains(@style,'font-style: italic;') and contains(@style,'font-weight: bold;')]">''''<xsl:apply-templates/>''''</xsl:template>

    <!-- bold and underline -->
    <xsl:template priority="2.0" match="span[contains(@style, 'text-decoration: underline;') and contains(@style,'font-weight: bold;')]"><u>'''<xsl:apply-templates/>'''</u></xsl:template>
    
    <!-- italic and underline -->
    <xsl:template priority="2.0" match="span[contains(@style, 'text-decoration: underline;') and contains(@style,'font-style: italic;')]"><u>''<xsl:apply-templates/>''</u></xsl:template>
    
    <!-- italic -->
    <xsl:template priority="1.0" match="span[contains(@style,'font-style: italic;')]">''<xsl:apply-templates/>''</xsl:template>

    <!-- bold -->
    <xsl:template priority="1.0" match="span[contains(@style,'font-weight: bold;')]">'''<xsl:apply-templates/>'''</xsl:template>

    <!-- header blurfs -->
    <xsl:template match="h1">&#160;
&#160;
= <xsl:apply-templates/> =&#160;
</xsl:template>
    <xsl:template match="h2">&#160;
&#160;
== <xsl:apply-templates/> ==&#160;
</xsl:template>
    <xsl:template match="h3">&#160;
&#160;
=== <xsl:apply-templates/> ===&#160;
</xsl:template>
    <xsl:template match="h4">&#160;
&#160;
==== <xsl:apply-templates/> ====&#160;
</xsl:template>
    <xsl:template match="h5">&#160;
&#160;
===== <xsl:apply-templates/> =====&#160;
</xsl:template>
    <xsl:template match="h6">&#160;
&#160;
====== <xsl:apply-templates/> ======&#160;
</xsl:template>

</xsl:transform>
