<?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="feedbackurl"/>    
  <xsl:param name="aonumber"/>  
  <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/eventinfo/textspan[@pEventid='span1']"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>

<xsl:apply-templates select="notification/eventinfo/textspan[@pEventid='span2']"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>

<xsl:apply-templates select="notification/eventinfo/textspan[@pEventid='span3']"><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"/></title>
    </head>
    <body style="font-family:Arial,sans-serif; font-size:small">
      <b><xsl:apply-templates select="notification/greeting/textspan"/></b><hr/>
      <xsl:apply-templates select="notification/eventinfo/textspan[@pEventid='span1']"/><p/>
      <xsl:apply-templates select="notification/eventinfo/textspan[@pEventid='span2']"/><p/>
      <xsl:apply-templates select="notification/eventinfo/textspan[@pEventid='span3']"/><br/>

	  <p/><hr/><small><xsl:apply-templates select="notification/warning/textspan"/></small><p/>
    </body>
  </html>
  </xsl:template>

  
  <xsl:template match="textspan">
    <xsl:param name="outputFormat" select="'HTML'"/>
	<xsl:apply-templates select="feedbackurl|feedbacklink|aonumber|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="feedbackurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$feedbackurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$feedbackurl"/></xsl:if>
  </xsl:template>

  <xsl:template match="aonumber">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><b><xsl:value-of select="$aonumber"/></b></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$aonumber"/></xsl:if>
  </xsl:template>

  <xsl:template match="feedbacklink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$feedbackurl}"><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="$feedbackurl"/></xsl:if>
  </xsl:template>
  
</xsl:stylesheet>
