<?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: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: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>
		</html>
		
	</xsl:template>
	
	<!-- Marko: adding template for RID -->
	<xsl:template match="resourceurl">
		<xsl:param name="outputFormat" select="'HTML'"/>
		<xsl:if test="$outputFormat='HTML'"><span tabindex="0"><xsl:value-of select="$resourceurl"/></span></xsl:if>
		<xsl:if test="not($outputFormat='HTML')"><xsl:value-of select="$resourceurl"/></xsl:if>
	</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="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="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="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:stylesheet>

