<?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="subscriptionname"/>
  <xsl:param name="notificationtext"/>
  <xsl:param name="eventid"/>
  <xsl:param name="eventname"/>
  <xsl:param name="resourcename"/>
  <xsl:param name="resourceiscollection"/>
  <xsl:param name="resourceurl"/>
  <xsl:param name="parenturl"/>
  <xsl:param name="parentname"/>
  <xsl:param name="parentpath"/>
  <xsl:param name="contentaccessurl"/>
  <xsl:param name="folderaccessurl"/>
  <xsl:param name="deleteurl"/>
  <xsl:param name="administrationurl"/>
  <xsl:param name="mailto"/>
  <xsl:param name="newresourcelink"/>  
  <xsl:param name="isowner"/>
  <xsl:param name="detailsurl"/>  
  <xsl:param name="lastmodified"/>  
  <xsl:param name="lastmodifieduser"/>
  <xsl:param name="subscriptiondetailsurl"/> 
  <xsl:param name="resourceDescription"/> 
  <xsl:param name="righttoleft"/> 
  <xsl:param name="movetargetfoldername"/> 
  <xsl:param name="movetargetfolderurl"/> 
  <xsl:param name="movetargetresourcename"/>   
  <xsl:param name="roomname"/>  
  <xsl:param name="isroom"/>  
  <xsl:param name="roompath"/> 
  <xsl:param name="resourcePathInRoom"/>
  <xsl:param name="tbp_valid_until"/>
  <xsl:param name="roomResourceBeforeMove"/>
	
  <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=$eventid and @isCollection=$resourceiscollection]"><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"><xsl:with-param name="outputFormat" select="'plaintext'"/></xsl:apply-templates></title>
      </head>
      <body  style="font-family:Arial,sans-serif; font-size:small">
        <table>
          <tr>
            <td>
              <span style="font-size:medium; font-weight:bold;"><xsl:apply-templates select="notification/title/textspan"/></span>
            </td>
	    <td align="right" valign="bottom" style="font-size:xx-small">
   	      <xsl:if test="not($eventid='delete') and not($eventid='archive')">
	        <xsl:apply-templates select="notification/actioninfo/textspan[@isowner=$isowner]"/>
	      </xsl:if>
	    </td>
          </tr>
          <tr>
   	    <td colspan="2"><hr/></td>
	  </tr>
          <tr>
            <td colspan="2"><pre style="font-style:italic;" tabindex="0"><xsl:value-of select="$notificationtext"/></pre>
            </td>
          </tr>
          <tr>
	    <td colspan="2">
              <xsl:apply-templates select="notification/eventinfo/textspan[@pEventid=$eventid and @isCollection=$resourceiscollection]"/>
	    </td>
	  </tr>
          <tr>
   	    <td colspan="2"><hr/></td>
	  </tr>
	</table>
		<span style="font-size:small"><xsl:apply-templates select="notification/deletion-warning/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="movetargetresourcename|movetargetfolderurl|movetargetfoldername|movetargetresourcelink|movetargetfolderlink|resourcename|parentname|parentpath|resourceDescription|lastmodified|lastmodifieduser|subscriptiondetailsurl|subscriptiondetailslink|newresourcelink|subscriptionname|notificationtext|eventid|eventname|parenturl|contentaccessurl|folderaccessurl|deleteurl|administrationurl|mailto|subscriptionlink|resourcelink|parentlink|deletelink|administerlink|mailtolink|detailsurl|detailslink|roomname|roomlink|resourcePathInRoom|resourcePathInRoomLink|tbp_valid_until|roomResourceBeforeMove|roomResourceBeforeMoveLink|moveResourceInRoomLink|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="movetargetfoldername">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$movetargetfoldername"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$movetargetfoldername"/></xsl:if>
  </xsl:template>

  <xsl:template match="movetargetfoldername">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$movetargetfolderurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$movetargetfolderurl"/></xsl:if>
  </xsl:template>

  <xsl:template match="movetargetresourcename">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$movetargetresourcename"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$movetargetresourcename"/></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="parentname">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$parentname"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$parentname"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="parentpath">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$parentpath"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$parentpath"/></xsl:if>
  </xsl:template>  

  <xsl:template match="resourceDescription">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$resourceDescription"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$resourceDescription"/></xsl:if>
  </xsl:template>

  <xsl:template match="lastmodified">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$lastmodified"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$lastmodified"/></xsl:if>
  </xsl:template>

  <xsl:template match="lastmodifieduser">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$lastmodifieduser"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$lastmodifieduser"/></xsl:if>
  </xsl:template>

  <xsl:template match="subscriptiondetailsurl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$subscriptiondetailsurl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$subscriptiondetailsurl"/></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="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="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="parenturl">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$parenturl"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$parenturl"/></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="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="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="subscriptiondetailslink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$subscriptiondetailsurl}"><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="$subscriptiondetailsurl"/>)</xsl:if>
  </xsl:template>

  <xsl:template match="movetargetfolderlink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$movetargetfolderurl}"><xsl:attribute name="title"><xsl:value-of select="$movetargetfoldername"/></xsl:attribute><xsl:value-of select="$movetargetfoldername"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="text()"/> (<xsl:value-of select="$movetargetfolderurl"/>)</xsl:if>
  </xsl:template>
  
  <xsl:template match="movetargetresourcelink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$contentaccessurl}"><xsl:attribute name="title"><xsl:value-of select="$movetargetresourcename"/></xsl:attribute><xsl:value-of select="$movetargetresourcename"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="text()"/> (<xsl:value-of select="$contentaccessurl"/>)</xsl:if>
  </xsl:template>  
  
  
  <xsl:template match="newresourcelink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$contentaccessurl}"><xsl:attribute name="title"><xsl:value-of select="$newresourcelink"/></xsl:attribute><xsl:value-of select="$newresourcelink"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="text()"/> (<xsl:value-of select="$contentaccessurl"/>)</xsl:if>
  </xsl:template>
  
  <xsl:template match="subscriptionlink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$subscriptiondetailsurl}"><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="$subscriptiondetailsurl"/>)</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="$parentpath"/></xsl:attribute><xsl:value-of select="$parentpath"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$parentname"/> (<xsl:value-of select="$parentpath"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$parentpath"/></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="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:template match="roomname">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$roomname"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$roomname"/></xsl:if>
  </xsl:template>
    
  <xsl:template match="roomlink">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><a href="{$roompath}"><xsl:attribute name="title"><xsl:value-of select="$roomname"/></xsl:attribute><xsl:value-of select="$roomname"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$roomname"/> (<xsl:value-of select="$roompath"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$roomname"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="resourcePathInRoom">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$resourcePathInRoom"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$resourcePathInRoom"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="resourcePathInRoomLink">
    <xsl:param name="outputFormat" select="'HTML'"/>
	<xsl:if test="$outputFormat='HTML'"><a href="{$folderaccessurl}"><xsl:attribute name="title"><xsl:value-of select="$resourcePathInRoom"/></xsl:attribute><xsl:value-of select="$resourcePathInRoom"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$resourcePathInRoom"/> (<xsl:value-of select="$resourcePathInRoom"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$resourcePathInRoom"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="tbp_valid_until">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$tbp_valid_until"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$tbp_valid_until"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="roomResourceBeforeMove">
    <xsl:param name="outputFormat" select="'HTML'"/>
    <xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$roomResourceBeforeMove"/></span></xsl:if>
    <xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$roomResourceBeforeMove"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="roomResourceBeforeMoveLink">
    <xsl:param name="outputFormat" select="'HTML'"/>	
	<xsl:if test="$outputFormat='HTML'"><a href="{$folderaccessurl}"><xsl:attribute name="title"><xsl:value-of select="$roomResourceBeforeMove"/></xsl:attribute><xsl:value-of select="$roomResourceBeforeMove"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$roomResourceBeforeMove"/> (<xsl:value-of select="$roomResourceBeforeMove"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$roomResourceBeforeMove"/></xsl:if>
  </xsl:template>
  
  <xsl:template match="moveResourceInRoomLink">
    <xsl:param name="outputFormat" select="'HTML'"/>	
	<xsl:if test="$outputFormat='HTML'"><a href="{$movetargetfolderurl}"><xsl:attribute name="title"><xsl:value-of select="$resourcePathInRoom"/></xsl:attribute><xsl:value-of select="$resourcePathInRoom"/></a></xsl:if>
    <xsl:if test="$outputFormat='plaintext'"><xsl:value-of select="$resourcePathInRoom"/> (<xsl:value-of select="$resourcePathInRoom"/>)</xsl:if>
    <xsl:if test="$outputFormat='plaintextsms'"><xsl:value-of select="$resourcePathInRoom"/></xsl:if>
  </xsl:template>
  
</xsl:stylesheet>
