<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:d="http://www.lotus.com/dxl">
	<xsl:variable name="uid">
		<xsl:value-of select="//d:document/d:noteinfo/@unid"/>
	</xsl:variable>
	<xsl:variable name="pname">
		<xsl:value-of select="//d:document/d:item[@name='DocTitle']"/>
	</xsl:variable>
	<xsl:template match="/">
		<xsl:apply-templates select="//d:document"/>
	</xsl:template>
	<xsl:template match="d:document">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<style type="text/css">
			BODY, TD {
			    font-family: Arial;
				color: black;
				font-size: 9pt;
				font-weight: normal;
				text-decoration: none; }

			TABLE.tablestyle1 TD { border-width: 1 0 0 1; border-color: black }
			TABLE.tablestyle1 TD:first-child, TABLE.tablestyle1 TH:first-child { border-width: 1 0 0 0  }
			TABLE.tablestyle1 > TR:first-child > TD, TABLE.tablestyle1 > TR:first-child > TH { border-width: 0 0 0 1; }
			TABLE.tablestyle1 > TR:first-child > TD:first-child, TABLE.tablestyle1 > TR:first-child > TH:first-child { border-width: 0; }
			TABLE.tablestyle1 { border-width: 1; border-spacing: 0px 0px; border-color: black; empty-cells: show }

			<xsl:for-each select="//d:pardef">
				.par_<xsl:value-of select="$uid"/>_<xsl:value-of select="@id"/> {
				<xsl:if test="@align">
				text-align: <xsl:choose>
						<xsl:when test="contains(@align,'full')">justify; width: 100%;</xsl:when>
						<xsl:otherwise><xsl:value-of select="@align"/>;</xsl:otherwise>
					</xsl:choose>
				</xsl:if>
				<xsl:if test="contains(@newpage,'true')">page-break-before: always;</xsl:if>
				}
			</xsl:for-each>
		</style>
	</head>
<body>
		<xsl:apply-templates select="d:item"/>
</body>
</html>
	</xsl:template>
	<xsl:template match="d:item">
		<xsl:apply-templates select="d:richtext"/>
	</xsl:template>
	<xsl:template match="d:richtext">
		<xsl:apply-templates/>
	</xsl:template>
	<xsl:template match="d:horizrule">
		<hr>
			<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
			<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
		</hr>
	</xsl:template>
	<xsl:template match="d:table">
		<!--  &#160; -->
		<table width="100%" cellspacing="0" xcellpadding="0">

			<xsl:if test="@rowspacing"><xsl:attribute name="cellpadding"><xsl:value-of select="@rowspacing"/></xsl:attribute></xsl:if>

			<xsl:if test="@widthtype='fitmargins'"><xsl:attribute name="width">100%</xsl:attribute></xsl:if>
			<xsl:if test="not(string(@cellborderstyle))">
				<xsl:attribute name="class">tablestyle1</xsl:attribute>
			</xsl:if>
			<xsl:attribute name="style"><xsl:if
			    test="d:tablerow/d:tablecell/@borderwidth='0px'">border-width: 0;</xsl:if><xsl:if
				test="string(d:border/@width)">border-width: <xsl:value-of select="d:border/@width"/>;</xsl:if><xsl:if
				test="string(d:border/@style)"> border-style: <xsl:choose><xsl:when
					test="d:border/@style='dot'">dotted</xsl:when><xsl:when
					test="d:border/@style='dash'">dashed</xsl:when><xsl:otherwise><xsl:value-of
					select="d:border/@style"/></xsl:otherwise></xsl:choose>;</xsl:if><xsl:choose><xsl:when
						test="string(d:border/@color)"> border-color: <xsl:value-of
						select="d:border/@color"/>;</xsl:when><xsl:otherwise><xsl:if
				test="not(string(@cellborderstyle))">border-color: black;</xsl:if></xsl:otherwise></xsl:choose></xsl:attribute>
			<xsl:if test="string(@cellborderstyle)"><xsl:choose><xsl:when
						test="string(d:border/@width)"><xsl:attribute name="border"><xsl:value-of
						select="d:border/@width"/></xsl:attribute></xsl:when><xsl:otherwise><xsl:attribute
						name="border">1</xsl:attribute><xsl:attribute name="cellspacing">1</xsl:attribute></xsl:otherwise></xsl:choose>
			</xsl:if>
			<xsl:apply-templates/>
			<tr>
				<xsl:for-each select="d:tablecolumn">
					<!--This sets the column widths-->
					<td>
						<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
					</td>
				</xsl:for-each>
			</tr>
		</table>
	</xsl:template>
	<xsl:template match="d:tablerow">
		<tr>
			<xsl:apply-templates/>
		</tr>
	</xsl:template>
	<xsl:template match="d:tablecell">
		<td valign="top">


			<xsl:attribute name="style"><xsl:choose>
				<xsl:when test="../../@cellborderstyle"></xsl:when>
				<xsl:otherwise><xsl:choose>
					<xsl:when test="string(../../@cellbordercolor)">border-color: <xsl:value-of select="../../@cellbordercolor"/>;</xsl:when>
					<xsl:otherwise>border-color: black;</xsl:otherwise>
				</xsl:choose></xsl:otherwise>
			</xsl:choose><xsl:if test="string(@borderwidth)">border-width: <xsl:value-of select="@borderwidth"/>;</xsl:if><xsl:choose><xsl:when
			test="string(@bgcolor)"> background-color: <xsl:value-of select="@bgcolor"/>;</xsl:when>
				</xsl:choose></xsl:attribute>
			<xsl:if test="@columnspan"><xsl:attribute name="colspan"><xsl:value-of select="@columnspan"/></xsl:attribute></xsl:if>
			<xsl:if test="@rowspan"><xsl:attribute name="rowspan"><xsl:value-of select="@rowspan"/></xsl:attribute></xsl:if>
			<xsl:apply-templates/>
		</td>
	</xsl:template>

	<xsl:template match="d:pardef">
	</xsl:template>

	<xsl:template match="d:par">
		<xsl:choose>
		<xsl:when test="@def">
			<xsl:variable name="defnum" select="@def"/>
			<xsl:call-template name="processpar"><xsl:with-param
			name="defnum" select="$defnum"/></xsl:call-template>
		</xsl:when>
		<xsl:otherwise>
			<xsl:variable name="defnum" select="preceding-sibling::d:par[@def][1]/@def"/>
			<xsl:call-template name="processpar"><xsl:with-param
			name="defnum" select="$defnum"/></xsl:call-template>
		</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="processpar">
		<xsl:param name="defnum"/>
		<xsl:choose>
			<xsl:when test="contains(//d:pardef[@id=$defnum]/@list, 'bullet')">
				<xsl:if test="preceding-sibling::d:par[@def][1]/@def!=$defnum">
					<xsl:text disable-output-escaping='yes'><![CDATA[<ul>]]></xsl:text>
				</xsl:if>
					<li>
						<xsl:attribute name="class">par_<xsl:value-of select="$uid"/>_<xsl:value-of select="$defnum"/></xsl:attribute>
						<xsl:apply-templates/>
					</li>
				<xsl:choose>
					<xsl:when test="following-sibling::d:par[1]">
						<xsl:if test="following-sibling::d:par[1]/@def">
							<xsl:if test="not(contains(following-sibling::d:par[1]/@def,$defnum))">
								<xsl:text disable-output-escaping='yes'><![CDATA[</ul>]]></xsl:text>
							</xsl:if>
						</xsl:if>
					</xsl:when>
					<xsl:otherwise>
							<xsl:text disable-output-escaping='yes'><![CDATA[</ul>]]></xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>

			<xsl:when test="contains(//d:pardef[@id=$defnum]/@list, 'number')">
				<xsl:if test="preceding-sibling::d:par[@def][1]/@def!=$defnum">
					<xsl:text disable-output-escaping='yes'><![CDATA[<ol>]]></xsl:text>
				</xsl:if>
					<li>
						<xsl:attribute name="class">par_<xsl:value-of select="$uid"/>_<xsl:value-of select="$defnum"/></xsl:attribute>
						<xsl:apply-templates/>
					</li>
				<xsl:choose>
					<xsl:when test="following-sibling::d:par[1]">
						<xsl:if test="following-sibling::d:par[1]/@def">
							<xsl:if test="not(contains(following-sibling::d:par[1]/@def,$defnum))">
								<xsl:text disable-output-escaping='yes'><![CDATA[</ol>]]></xsl:text>
							</xsl:if>
						</xsl:if>
					</xsl:when>
					<xsl:otherwise>
							<xsl:text disable-output-escaping='yes'><![CDATA[</ol>]]></xsl:text>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:when>

			<xsl:otherwise>
				<p>
					<xsl:attribute name="class">par_<xsl:value-of select="$uid"/>_<xsl:value-of select="$defnum"/></xsl:attribute>
						<xsl:apply-templates/>
						<xsl:if test="normalize-space(.) = ''"><!--  &#160; --> </xsl:if>
					</p>
				</xsl:otherwise>
			</xsl:choose>


	</xsl:template>

	<xsl:template match="d:run"><font><xsl:attribute
		name="style"><xsl:call-template name="build-style"><xsl:with-param
		name="el" select="."/></xsl:call-template></xsl:attribute><xsl:apply-templates/><xsl:if test="normalize-space(.) = ''"><!--  &#160; --> </xsl:if></font></xsl:template>

	<xsl:template match="d:break">
		<br/>
	</xsl:template>

	<xsl:template match="d:button">
		<input type="button">
			<xsl:attribute name="value"><xsl:value-of select="normalize-space(.)"/></xsl:attribute>
		</input>
	</xsl:template>

	<xsl:template match="d:embeddedcontrol">
		<xsl:choose>
			<xsl:when test="@type = 'edit'">
				<div>
				<xsl:attribute name="style">border: 1 inset; padding: 2; <xsl:if test="@widthtype = 'fitwindow'">width: 100%;</xsl:if><xsl:call-template
				name="build-style"><xsl:with-param name="el" select="."/></xsl:call-template></xsl:attribute><xsl:apply-templates/>&#160;
				</div>
			</xsl:when>
			<xsl:otherwise>
				<div xwidth="10">
				<xsl:if test="string(@borderstyle)"><xsl:attribute name="style">border-width: 1; border-style: <xsl:value-of select="@borderstyle"/>;</xsl:attribute></xsl:if>
				<xsl:if test="@widthtype = 'fitwindow'"><xsl:attribute name="style">width: 100%;</xsl:attribute></xsl:if>
				<xsl:apply-templates/>
				</div>
			</xsl:otherwise>
		</xsl:choose>

	</xsl:template>

	<xsl:template match="d:embeddedkeywords">
		<xsl:for-each select="d:keyword">
			<input type="radio"/><xsl:value-of select="text()"/><br/>
		</xsl:for-each>
	</xsl:template>

	<xsl:template match="d:urllink">
		<a><xsl:attribute name="href"><xsl:value-of select="@href"/></xsl:attribute><xsl:apply-templates/></a>
	</xsl:template>

	<xsl:template match="d:attachmentref">
		<xsl:variable name="attkey"><xsl:value-of select="@name"/></xsl:variable>
		<pd4ml-attachment icon="Area">
			<xsl:attribute name="description"><xsl:value-of select="@displayname"/></xsl:attribute>
			<xsl:attribute name="height"><xsl:value-of select="d:picture/@height"/></xsl:attribute>
			<xsl:attribute name="width"><xsl:value-of select="d:picture/@width"/></xsl:attribute>
			<xsl:attribute name="src">data:image/gif;base64,<xsl:call-template name="getbody">
				<xsl:with-param name="p1" select="$attkey"/>
			</xsl:call-template></xsl:attribute>
		</pd4ml-attachment>
		<img>
			<xsl:attribute name="height"><xsl:value-of select="d:picture/@height"/></xsl:attribute>
			<xsl:attribute name="width"><xsl:value-of select="d:picture/@width"/></xsl:attribute>
			<xsl:attribute name="src">data:image/gif;base64,<xsl:value-of select="normalize-space(d:picture/d:gif)" disable-output-escaping="yes"/></xsl:attribute>
			<xsl:attribute name="border">0</xsl:attribute>
		</img>
	</xsl:template>
	<xsl:template match="d:picture">
		<img>
			<xsl:attribute name="height"><xsl:value-of select="@height"/></xsl:attribute>
			<xsl:attribute name="width"><xsl:value-of select="@width"/></xsl:attribute>
			<xsl:attribute name="src">data:image/gif;base64,<xsl:value-of select="normalize-space(d:gif)" disable-output-escaping="yes"/><xsl:value-of select="d:jpeg" disable-output-escaping="yes"/></xsl:attribute>
			<xsl:attribute name="border">0</xsl:attribute>
		</img>
	</xsl:template>

	<xsl:template name="getbody">
		<xsl:param name="p1"/>
		<xsl:for-each select="/d:document/d:item/d:object/d:file">
			<xsl:if test="contains( @name, $p1 )">
				<xsl:value-of select="normalize-space(d:filedata/text())" disable-output-escaping="yes"/>
			</xsl:if>
		</xsl:for-each>
	</xsl:template>

	<xsl:template name="get-value">
		<xsl:param name="reference"/>
		<xsl:param name="default"/>
		<xsl:choose>
			<xsl:when test="count(whatever) &gt; 0">
				<xsl:value-of select="whatever"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$default"/>
				<!-- xsl:call-template name="get-value"><xsl:with-param name="reference" select=""/><xsl:with-param name="default">inherit</xsl:with-param></xsl:call-template -->
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="build-style">
		<xsl:param name="el"/><xsl:if
			test="d:font/@name"> font-family: <xsl:value-of select="d:font/@name"/>;</xsl:if><xsl:if
			test="d:font/@size"> font-size: <xsl:value-of select="d:font/@size"/>;</xsl:if><xsl:if
			test="contains(d:font/@style, 'bold')"> font-weight: bold;</xsl:if><xsl:if
			test="contains(d:font/@style, 'italic')"> font-style: italic;</xsl:if><xsl:if
			test="contains(d:font/@style, 'superscript')"> vertical-align: super;</xsl:if><xsl:if
			test="contains(d:font/@style, 'subscript')"> vertical-align: sub;</xsl:if><xsl:if
			test="contains(d:font/@style, 'underline')"> text-decoration: underline;</xsl:if><xsl:if
			test="contains(d:font/@style, 'strikethrough')"> text-decoration: line-through;</xsl:if><xsl:if
			test="string(d:font/@color)"> color: <xsl:value-of select="d:font/@color"/>;</xsl:if></xsl:template>

</xsl:stylesheet>