﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output method="xml" indent="no" omit-xml-declaration="yes"/>
  <xsl:template match="/">
    <div class="note">
      <xsl:apply-templates />
    </div>
  </xsl:template>
  <xsl:template match="formatUnit">
    <xsl:choose>
      <xsl:when test="@align = 'center'">
        <p>
          <xsl:attribute name="style">
            text-align:<xsl:value-of select="@align"/>;
          </xsl:attribute>
          <xsl:apply-templates />
        </p>
      </xsl:when>
      <xsl:when test="br">
        <br/>
      </xsl:when>
      <xsl:when test="@color">
        <span>
        <xsl:attribute name="style">
          <xsl:if test="@color">
            color:rgb(<xsl:value-of select="@color"/>);
          </xsl:if>
        </xsl:attribute>
        <xsl:apply-templates />
        </span>
      </xsl:when>
	  <xsl:when test="@isUnderlined">
		<u>
		<xsl:apply-templates />
		</u>
	  </xsl:when>
      <xsl:otherwise>
          <xsl:choose>
            <xsl:when test="@isTitle">
              <h2>
                <xsl:choose>
                  <xsl:when test="@refParams">
                    <a>
                      <xsl:attribute name="href">
                        <xsl:value-of select="@refParams"/>
                      </xsl:attribute>
                      <xsl:attribute name="title">
                        <xsl:value-of select="@refTooltip"/>
                      </xsl:attribute>
                      <xsl:value-of select="."/>
                    </a>
                  </xsl:when>
                  <xsl:otherwise>
                    <xsl:value-of select="."/>
                  </xsl:otherwise>
                </xsl:choose>
              </h2>
            </xsl:when>
            <xsl:otherwise>
              <xsl:choose>
                <xsl:when test="@refParams">
                  <a>
                    <xsl:attribute name="target">
                      _blank
                    </xsl:attribute>
                    <xsl:attribute name="href">
                      <xsl:value-of select="@refParams"/>
                    </xsl:attribute>
                    <xsl:attribute name="title">
                      <xsl:value-of select="@refTooltip"/>
                    </xsl:attribute>
                    <xsl:value-of select="."/>
                  </a>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:value-of select="."/>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:otherwise>
          </xsl:choose>
     
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
</xsl:stylesheet>
