<?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="operation"/>
  <xsl:param name="subscriptionname"/>
  <xsl:param name="notificationtext"/>
  <xsl:param name="eventid"/>
  <xsl:param name="eventname"/>
  <xsl:param name="deleteurl"/>
  <xsl:param name="administrationurl"/>
  <xsl:param name="mailto"/>
  <xsl:param name="isowner"/>
  <xsl:param name="righttoleft"/> 
  <xsl:param name="resourceiscollection"/>
  <xsl:param name="resourcerid"/>
  <xsl:param name="parentrid"/>
  <xsl:param name="contentaccessurl"/>
  <xsl:param name="folderaccessurl"/>
  <xsl:param name="detailsurl"/>
  <xsl:param name="folderdetailsurl"/> 
  <xsl:param name="resourcename"/>    

  <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=$operation]"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates>

<xsl:value-of select="$notificationtext"/>

<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=$operation]"/>
		  
        <p/>
        <pre style="font-style:italic;" tabindex="0"><xsl:value-of select="$notificationtext"/></pre>
		  <xsl:if test="not($operation='delete')">  
		    <xsl:apply-templates select="notification/actioninfo/textspan[@isowner=$isowner]"/>
		  </xsl:if>
	    <hr/>
	    <span style="font-size:small"><xsl:apply-templates select="notification/deletion-warning/textspan"/></span><br/>
	    <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="folderdetailsurl|detailslink|parentlink|resourcename|detailsurl|resourcelink|folderaccessurl|contentaccessurl|parentrid|resourcerid|subscriptionname|notificationtext|isowner|eventid|eventname|deleteurl|administrationurl|mailto|subscriptionlink|deletelink|administerlink|mailtolink|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="subscriptionname">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$subscriptionname"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$subscriptionname"/></xsl:if>
  </xsl:template>

  <xsl:template match="notificationtext">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$notificationtext"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$notificationtext"/></xsl:if>
  </xsl:template>

  <xsl:template match="isowner">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$isowner"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$isowner"/></xsl:if>
  </xsl:template>

  <xsl:template match="eventid">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$eventid"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$eventid"/></xsl:if>
  </xsl:template>

  <xsl:template match="eventname">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$eventname"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$eventname"/></xsl:if>
  </xsl:template>

  <xsl:template match="deleteurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$deleteurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$deleteurl"/></xsl:if>
  </xsl:template>

  <xsl:template match="administrationurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$administrationurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$administrationurl"/></xsl:if>
  </xsl:template>

  <xsl:template match="mailto">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$mailto"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$mailto"/></xsl:if>
  </xsl:template>

  <xsl:template match="subscriptionlink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$administrationurl}"><xsl:attribute name="title"><xsl:value-of select="$subscriptionname"/></xsl:attribute><xsl:value-of select="$subscriptionname"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$subscriptionname"/> (<xsl:value-of select="$administrationurl"/>)</xsl:if>
  </xsl:template>
  
  <xsl:template match="deletelink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$deleteurl}"><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="$deleteurl"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="administerlink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$administrationurl}"><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="$administrationurl"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="mailtolink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$mailto}"><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="$mailto"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="resourcename">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$resourcename"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$resourcename"/></xsl:if>
  </xsl:template>  
  
  <xsl:template match="parentrid">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$parentrid"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$parentrid"/></xsl:if>
  </xsl:template>

  <xsl:template match="contentaccessurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$contentaccessurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$contentaccessurl"/></xsl:if>
  </xsl:template>  
  
  <xsl:template match="folderaccessurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$folderaccessurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$folderaccessurl"/></xsl:if>
  </xsl:template>  
  
  <xsl:template match="detailsurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$detailsurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$detailsurl"/></xsl:if>
  </xsl:template>  
  
  <xsl:template match="resourcelink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$contentaccessurl}"><xsl:attribute name="title"><xsl:value-of select="$resourcename"/></xsl:attribute><xsl:value-of select="$resourcename"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$resourcename"/> (<xsl:value-of select="$contentaccessurl"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$resourcename"/></xsl:if>
  </xsl:template>  
   
  <xsl:template match="parentlink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$folderaccessurl}"><xsl:attribute name="title"><xsl:value-of select="$parentrid"/></xsl:attribute><xsl:value-of select="$parentrid"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$parentrid"/> (<xsl:value-of select="$folderaccessurl"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$parentrid"/></xsl:if>
  </xsl:template>  
  
  <xsl:template match="detailslink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$detailsurl}"><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="$detailsurl"/></xsl:if>
  </xsl:template>   
  
</xsl:stylesheet>

