<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="DAV:" xmlns:y="SAP:">
  <xsl:output method='html'/>
  <xsl:param name="host_first_name"/>
  <xsl:param name="host_last_name"/>
  <xsl:param name="recipient_first_name"/>
  <xsl:param name="recipient_last_name"/>
  <xsl:param name="accept_url"/>
  <xsl:param name="reject_url"/>
  <xsl:param name="provider_name"/>
  <xsl:param name="righttoleft"/>
  <xsl:template match="/">
  <xsl:output encoding="UTF-8" />

<xsl:comment xml:space="preserve">

<xsl:apply-templates select="notification/greeting/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>
<xsl:apply-templates select="notification/invitation_content/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>
<xsl:apply-templates select="notification/invitation_accept/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>
<xsl:apply-templates select="notification/invitation_reject/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>
<xsl:apply-templates select="notification/warning/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>
<xsl:apply-templates select="notification/txtwarning/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>

</xsl:comment>

    <html><xsl:if test="$righttoleft='true'"><xsl:attribute name="dir">rtl</xsl:attribute></xsl:if>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title><xsl:apply-templates select="notification/title/textspan"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates></title>
      </head>
      <body  style="font-family:Arial,sans-serif; font-size:small">
		<span style="font-size:xx-small"><xsl:apply-templates select="notification/greeting/textspan"/></span><br/>
		<span style="font-size:xx-small"><xsl:apply-templates select="notification/invitation_content/textspan"/></span><br/>
		<span style="font-size:xx-small"><xsl:apply-templates select="notification/invitation_accept/textspan"/></span><br/>
		<span style="font-size:xx-small"><xsl:apply-templates select="notification/invitation_reject/textspan"/></span><br/>
		<span style="font-size:xx-small"><xsl:apply-templates select="notification/warning/textspan"/></span>
      </body>
    </html>
  </xsl:template>
  
  <xsl:template match="textspan">
    <xsl:param name="outputFormat" select="'HTML'"/>
	<xsl:apply-templates select="accept_link|reject_link|accept_url|reject_url|host_first_name|host_last_name|recipient_first_name|recipient_last_name|provider_name|text()"><xsl:with-param name="outputFormat" select="$outputFormat"/></xsl:apply-templates>
  </xsl:template>

  <xsl:template match="text()">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="."/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="."/></xsl:if>
  </xsl:template>
  
  <xsl:template match="accept_link">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$accept_url}"><xsl:attribute name="title"><xsl:value-of select="text()"/></xsl:attribute><xsl:value-of select="text()"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="text()"/> - <xsl:value-of select="$accept_url"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="reject_link">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$reject_url}"><xsl:attribute name="title"><xsl:value-of select="text()"/></xsl:attribute><xsl:value-of select="text()"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="text()"/> - <xsl:value-of select="$reject_url"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="accept_url">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$accept_url"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$accept_url"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="reject_url">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$reject_url"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$reject_url"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="host_first_name">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$host_first_name"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$host_first_name"/></xsl:if>
  </xsl:template>
  
    <xsl:template match="host_last_name">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$host_last_name"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$host_last_name"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="recipient_first_name">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$recipient_first_name"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$recipient_first_name"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="recipient_last_name">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$recipient_last_name"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$recipient_last_name"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="provider_name">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$provider_name"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$provider_name"/></xsl:if>
  </xsl:template>
</xsl:stylesheet>
