/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2012 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
SET SCAN OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  l_XSL_NAME CONSTANT fnd_lobs.file_name%TYPE
    := 'XxasTimecardDetailNotificationXsl.xsl';
  l_clob              CLOB;
  l_blob              BLOB;
  l_dest_offsset      INTEGER := 1;
  l_src_offsset       INTEGER := 1;
  l_lang_context      INTEGER := dbms_lob.default_lang_ctx;
  l_warning           INTEGER;

BEGIN

  l_clob := '<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:template match="/">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    </head>

    <body style="margin:0;padding:0; background-color:#F4F4F4; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif;">

    <!--Outermost Table-->

    <table border="0" cellpadding="0" cellspacing="0" style="font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif;width: 100%; background-color:#F4F4F4;">
      <tr>
        <td><!--Main Container Table-->

          <table width="604" align="center" style="background-color:#FFFFFF; border:1px solid #e2e2e2; -moz-box-shadow:0 0 3px rgba(0,0,0,0.10);-webkit-box-shadow:0 0 3px rgba(0,0,0,0.10); border-radius: 5px;-moz-border-radius:5px; -webkit-border-radius: 5px;" border="0" cellpadding="0" cellspacing="0">

            <!--Customer Logo and Name Table-->

            <tr style="background: #41565f">
              <td style="padding:15px ;margin:0;"><table width="100%%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td>
                      <img style="max-height:56px; padding-left:10px">
                        <xsl:attribute name="src"> <xsl:value-of select="Notification/Header/CustomerLogoUrl" /> </xsl:attribute>
                      </img>
                    </td>
                    <td><h3 style="color:#FFFFFF; font-family: -apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; font-size:18px; font-weight:normal; margin-left:10px; padding:0px 10px 0px 0px; text-align:right"><xsl:value-of select="Notification/Header/CustomerStrap" /></h3></td>
                  </tr>
                </table></td>
            </tr>

            <!--Timecard Totals-->

            <tr>
              <td width="100%" style="padding:0px ;margin:0;"><table width="100%" border="0" cellspacing="10" cellpadding="0">
                  <xsl:attribute name="style">border-bottom:1px solid #475f6f; background-repeat:no-repeat; background:#41565f; background-size:cover </xsl:attribute>
                  <tr>
                    <td colspan="4"><!--Timekeeper and Period-->

                      <table width="100%%" border="0" cellspacing="0" cellpadding="0" style="padding:0px; margin-left:10px;">
                        <tr>
                          <td width="14%" style="padding:0px; border:none; border-width:0px; text-align:center;"><img width="116px" height="116px" alt="Photo" style=" margin:5px;color:#ffffff; background:#ffffff; padding:0px; border-radius: 58px;-moz-border-radius: 58px; border:solid; border-color:#fafafa; border-width:3px; text-align:center;">
                            <xsl:attribute name="src"> <xsl:value-of select="Notification/Header/PersonPhotoUrl" /> </xsl:attribute>
                            </img></td>
                          <td width="88%" style="margin-left:20px;"><h2 style="color:#FFFFFF !important; font-family: -apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; font-size:24px; font-weight:normal; margin-left:10px; padding:0px 10px 0px 0px;"> <xsl:value-of select="/Notification/Header/PersonName" />  <br />
                              Timecard: <xsl:value-of select="Notification/Header/TimecardPeriodName" />  </h2>
                            <span style="color:#FFFFFF !important; font-size:16px; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; margin-left:10px; margin-top:0px; padding:0px 0px 0px 0px; line-height:10px;"> As at: <xsl:value-of select="Notification/Header/EffectiveDate" /> </span></td>
                        </tr>
                      </table></td>
                  </tr>
                  <tr>
                    <td width="100%%" colspan="2" style="margin:0;"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-left:10px; padding:10px;font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#2d3b41; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#333333; border-width:1px; text-align:center;">
                        <tr>
                          <td border="0" style="padding:10px;"> <span style="font-size:36px; color:#FFFFFF; padding:10px;"> <xsl:value-of select="Notification/Header/TimecardTotal" /> </span> <br />
                            <xsl:choose>
                              <xsl:when test="Notification/Header/TimecardTotal != 1">
                                Entries
                              </xsl:when>
                              <xsl:otherwise>
                                Entry
                              </xsl:otherwise>
                            </xsl:choose>
                            submitted in total </td>
                          <td><table border="0" cellspacing="10" cellpadding="0">
                              <tr>
                                <td style="padding:10px;font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#ff9900; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#333333; border-width:1px; text-align:center;"><xsl:if test="Notification/Header/PendingChanged != 0">
                                    <xsl:attribute name="style">padding:10px; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#ff9900; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#ffffff; border-width:3px; text-align:center;</xsl:attribute>
                                  </xsl:if>
                                   <span style="font-size:36px"> <xsl:value-of select="Notification/Header/PendingTotal" /> </span> <br />
                                  Pending </td>
                                <td style="padding:10px;font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#cc0000; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#333333; border-width:1px; text-align:center;"><xsl:if test="Notification/Header/ReturnedChanged != 0">
                                    <xsl:attribute name="style">padding:10px; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#cc0000; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#ffffff; border-width:3px; text-align:center;</xsl:attribute>
                                  </xsl:if>
                                   <span style="font-size:36px"> <xsl:value-of select="Notification/Header/ReturnedTotal" /> </span> <br />
                                  Returned </td>
                                <td style="padding:10px;font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#499324; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#333333; border-width:1px; text-align:center;"><xsl:if test="Notification/Header/ApprovedChanged != 0">
                                  <xsl:attribute name="style">padding:10px; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#499324; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#ffffff; border-width:3px; text-align:center;</xsl:attribute>
                                  </xsl:if>
                                   <span style="font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif;font-size:36px"> <xsl:value-of select="Notification/Header/ApprovedTotal" /></span> <br />
                                    Approved </td>
                                <td style="padding:10px;font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#339987; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#333333; border-width:1px; text-align:center;"><xsl:if test="Notification/Header/TransferredChanged != 0">
                                  <xsl:attribute name="style">padding:10px; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; color:#ffffff; background:#339987; width:100px; border-radius: 5px 5px 5px 5px;-moz-border-radius: 5px 5px 5px 5px; border:solid; border-color:#ffffff; border-width:3px; text-align:center;</xsl:attribute>
                                </xsl:if>
                                   <span style="font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif;font-size:36px"> <xsl:value-of select="Notification/Header/TransferredTotal" /></span> <br />
                                    Transferred </td>
                              </tr>

                            </table></td>
                        </tr>
                      </table></td>
                  </tr>
                </table></td>
            </tr>

            <!--Main Bulk of Email-->

            <tr>
              <td style="padding:15px ;margin:0;"><table width="100%%" border="0" cellspacing="0" cellpadding="0" style="margin:0px; padding:0px;">
                  <tr>
                    <td><h2 style="color:#222; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; font-size:24px;padding:0px 0 0px 0;margin:0;font-weight:normal ;margin-top:10px">You are being notified because:</h2>

                      <!--START PARAGRAPH TO BULLET SWITCHING-->
                      <!--IF THERE IS JUST ONE REASON FOR BEING NOTIFIED THEN RENDER AS PARAGRAPH-->

                      <xsl:choose>
                        <xsl:when test="(Notification/Header/ApprovedChanged = Notification/Header/TimecardChanged) or (Notification/Header/ReturnedChanged = Notification/Header/TimecardChanged) or (Notification/Header/PendingChanged = Notification/Header/TimecardChanged)">
                          <p style="font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; font-size:16px;">
                            <xsl:if test="Notification/Header/ApprovedChanged != 0">
                               <xsl:value-of select="Notification/Header/ApprovedChanged" />
                              <xsl:choose>
                                <xsl:when test="Notification/Header/ApprovedChanged != 1">
                                  entries
                                </xsl:when>
                                <xsl:otherwise>
                                  entry
                                </xsl:otherwise>
                              </xsl:choose>
                              <xsl:choose>
                                <xsl:when test="Notification/Header/ApprovedChanged != 1">
                                  have been
                                </xsl:when>
                                <xsl:otherwise>
                                  has been
                                </xsl:otherwise>
                              </xsl:choose>
                              approved by <xsl:value-of select="Notification/Header/ActionedBy" /> 
                              <xsl:if test="Notification/Header/ApprovedChanged != Notification/Header/ApprovedTotal">
                                <em>( <xsl:value-of select="Notification/Header/ApprovedTotal" />
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/ApprovedTotal != 1">
                                    entries
                                  </xsl:when>
                                  <xsl:otherwise>
                                    entry
                                  </xsl:otherwise>
                                </xsl:choose>
                                in total)</em>
                              </xsl:if>
                            </xsl:if>

                            <xsl:if test="Notification/Header/ReturnedChanged != 0">
                               <xsl:value-of select="Notification/Header/ReturnedChanged" />
                              <xsl:choose>
                                <xsl:when test="Notification/Header/ReturnedChanged != 1">
                                  entries
                                </xsl:when>
                                <xsl:otherwise>
                                  entry
                                </xsl:otherwise>
                              </xsl:choose>
                              <xsl:choose>
                                <xsl:when test="Notification/Header/ReturnedChanged != 1">
                                  have been
                                </xsl:when>
                                <xsl:otherwise>
                                  has been
                                </xsl:otherwise>
                              </xsl:choose>
                              returned by <xsl:value-of select="Notification/Header/ActionedBy" /> 
                              <xsl:if test="Notification/Header/ReturnedChanged != Notification/Header/ReturnedTotal">
                                <em>( <xsl:value-of select="Notification/Header/ReturnedTotal" />
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/ReturnedTotal != 1">
                                    entries
                                  </xsl:when>
                                  <xsl:otherwise>
                                    entry
                                  </xsl:otherwise>
                                </xsl:choose>
                                in total)</em>
                              </xsl:if>
                            </xsl:if>
                            <xsl:if test="Notification/Header/PendingChanged != 0">
                               <xsl:value-of select="Notification/Header/PendingChanged " />
                              <xsl:choose>
                                <xsl:when test="Notification/Header/PendingChanged != 1">
                                  entries
                                </xsl:when>
                                <xsl:otherwise>
                                  entry
                                </xsl:otherwise>
                              </xsl:choose>
                              <xsl:choose>
                                <xsl:when test="Notification/Header/PendingChanged != 1">
                                  have been
                                </xsl:when>
                                <xsl:otherwise>
                                  has been
                                </xsl:otherwise>
                              </xsl:choose>
                              submitted for approval by <xsl:value-of select="Notification/Header/ActionedBy" /> 
                              <xsl:if test="Notification/Header/PendingChanged  != Notification/Header/PendingTotal">
                                <em>( <xsl:value-of select="Notification/Header/PendingTotal" />
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/PendingTotal != 1">
                                    Entries
                                  </xsl:when>
                                  <xsl:otherwise>
                                    Entry
                                  </xsl:otherwise>
                                </xsl:choose>
                                in total)</em>
                              </xsl:if>
                            </xsl:if>
                          </p>
                        </xsl:when>

                        <!--IF THERE IS MORE THAN ONE REASON FOR BEING NOTIFIED THEN RENDER AS BULLETED LIST-->
                        <xsl:otherwise>
                          <ul style="font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; font-size:16px;">
                            <xsl:if test="Notification/Header/ApprovedChanged != 0">
                              <li>  <xsl:value-of select="Notification/Header/ApprovedChanged" />
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/ApprovedChanged != 1">
                                    entries
                                  </xsl:when>
                                  <xsl:otherwise>
                                    entry
                                  </xsl:otherwise>
                                </xsl:choose>
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/ApprovedChanged != 1">
                                    have been
                                  </xsl:when>
                                  <xsl:otherwise>
                                    has been
                                  </xsl:otherwise>
                                </xsl:choose>
                                approved by <xsl:value-of select="Notification/Header/ActionedBy" /> 
                                <xsl:if test="Notification/Header/ApprovedChanged != Notification/Header/ApprovedTotal">
                                  <em>( <xsl:value-of select="Notification/Header/ApprovedTotal" />
                                  <xsl:choose>
                                    <xsl:when test="Notification/Header/ApprovedTotal != 1">
                                      entries
                                    </xsl:when>
                                    <xsl:otherwise>
                                      entry
                                    </xsl:otherwise>
                                  </xsl:choose>
                                  in total)</em>
                                </xsl:if>
                              </li>
                            </xsl:if>
                            <xsl:if test="Notification/Header/ReturnedChanged != 0">
                              <li>  <xsl:value-of select="Notification/Header/ReturnedChanged" />
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/ReturnedChanged != 1">
                                    entries
                                  </xsl:when>
                                  <xsl:otherwise>
                                    entry
                                  </xsl:otherwise>
                                </xsl:choose>
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/ReturnedChanged != 1">
                                    have been
                                  </xsl:when>
                                  <xsl:otherwise>
                                    has been
                                  </xsl:otherwise>
                                </xsl:choose>
                                returned by <xsl:value-of select="Notification/Header/ActionedBy" /> 
                                <xsl:if test="Notification/Header/ReturnedChanged != Notification/Header/ReturnedTotal">
                                  <em>( <xsl:value-of select="Notification/Header/ReturnedTotal" />
                                  <xsl:choose>
                                    <xsl:when test="Notification/Header/ReturnedTotal != 1">
                                      entries
                                    </xsl:when>
                                    <xsl:otherwise>
                                      entry
                                    </xsl:otherwise>
                                  </xsl:choose>
                                  in total)</em>
                                </xsl:if>
                              </li>
                            </xsl:if>
                            <xsl:if test="Notification/Header/PendingChanged != 0">
                              <li>  <xsl:value-of select="Notification/Header/PendingChanged " />
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/PendingChanged != 1">
                                    entries
                                  </xsl:when>
                                  <xsl:otherwise>
                                    entry
                                  </xsl:otherwise>
                                </xsl:choose>
                                <xsl:choose>
                                  <xsl:when test="Notification/Header/PendingChanged != 1">
                                    have been
                                  </xsl:when>
                                  <xsl:otherwise>
                                    has been
                                  </xsl:otherwise>
                                </xsl:choose>
                                submitted for approval by <xsl:value-of select="Notification/Header/ActionedBy" /> 
                                <xsl:if test="Notification/Header/PendingChanged  != Notification/Header/PendingTotal">
                                  <em>( <xsl:value-of select="Notification/Header/PendingTotal" />
                                  <xsl:choose>
                                    <xsl:when test="Notification/Header/PendingTotal != 1">
                                      Entries
                                    </xsl:when>
                                    <xsl:otherwise>
                                      Entry
                                    </xsl:otherwise>
                                  </xsl:choose>
                                  in total)</em>
                                </xsl:if>
                              </li>
                            </xsl:if>
                          </ul>
                        </xsl:otherwise>
                      </xsl:choose>

                      <!--END PARAGRAPH TO BULLET SWITCHING-->

' || '
                      <!--Customer hook start - for Pre Detail HTML-->

                      <!--${FND_MESSAGE.XXAS.XXAS_TCM_POST_DETAIL_HTML}-->

                      <!--Customer hook end   - for Pre Detail HTML-->
                      <!--Table Heading-->

                      <xsl:for-each select="Notification/States/State">
                        <h2 style="padding-top:5px; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; margin:0 0 0 0; font-size:18px; font-weight:normal;"> <xsl:value-of select="Name"/> (<xsl:value-of select="Count"/>) </h2>
                        <xsl:for-each select="ElementTypes/ElementType">

                          <!--Data table-->

                          <table width="100%" cellpadding="0" cellspacing="0" style="font-family: -apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; background-color: #FFFFFF; text-align: left; font-size: 14px; border: 1px solid #f2f2f2; padding: 0px; color:#000000; margin:10px 0px 10px 0px;">
                            <tr bgcolor="#DDDFE0">
                              <td valign="middle" colspan="11" style="margin:0 0 0 0; padding-top:6px; padding-left:6px;padding-bottom:6px; padding-right:6px; font-size:18px;"><img>
                                <xsl:attribute name="src"> <xsl:value-of select="ElementIconUrl" /> </xsl:attribute>
                                </img>  <xsl:value-of select="Name" /> </td>
                            </tr>
                            <tr style="padding:0px; margin:0;">

                              <!--START Column Headings-->

                              <!--HEADINGS -  EntryChangedStatus-->

                              <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 0px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;"></th>

                              <!--HEADINGS -  DATE-->

                              <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;"> Date </th>

                              <!--HEADINGS - DURATION-->

                              <xsl:if test="FieldAttributes/DurationShowFlag = ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;"> <xsl:value-of select="FieldAttributes/DurationLabel" /> </th>
                              </xsl:if>

                              <!--HEADINGS - START TIME-->

                              <xsl:if test="FieldAttributes/StartTimeShowFlag= ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;"> <xsl:value-of select="FieldAttributes/StartTimeLabel" /> </th>
                              </xsl:if>

                              <!--HEADINGS - END TIME-->

                              <xsl:if test="FieldAttributes/EndTimeShowFlag = ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;"> <xsl:value-of select="FieldAttributes/EndTimeLabel" /> </th>
                              </xsl:if>

                              <!--HEADINGS - FIELD 1-->

                              <xsl:if test="FieldAttributes/Field1ShowFlag = ''Y''">
                                <th style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 6px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;">
                                  <xsl:choose>
                                    <xsl:when test="FieldAttributes/Field1Align = ''R''">
                                      <xsl:attribute name="align">Right</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field1Label" />
                                    </xsl:when>
                                    <xsl:otherwise>
                                      <xsl:attribute name="align">Left</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field1Label" />
                                    </xsl:otherwise>
                                  </xsl:choose>
                                </th>
                              </xsl:if>

                              <!--HEADINGS - FIELD 2-->

                              <xsl:if test="FieldAttributes/Field2ShowFlag = ''Y''">
                                <th style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 6px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;">
                                  <xsl:choose>
                                    <xsl:when test="FieldAttributes/Field2Align = ''R''">
                                      <xsl:attribute name="align">Right</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field2Label" />
                                    </xsl:when>
                                    <xsl:otherwise>
                                      <xsl:attribute name="align">Left</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field2Label" />
                                    </xsl:otherwise>
                                  </xsl:choose>
                                </th>
                              </xsl:if>

                              <!--HEADINGS - FIELD 3-->

                              <xsl:if test="FieldAttributes/Field3ShowFlag = ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 6px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;">
                                  <xsl:choose>
                                    <xsl:when test="FieldAttributes/Field3Align = ''R''">
                                      <xsl:attribute name="align">Right</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field3Label" />
                                    </xsl:when>
                                    <xsl:otherwise>
                                      <xsl:attribute name="align">Left</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field3Label" />
                                    </xsl:otherwise>
                                  </xsl:choose>
                                </th>
                              </xsl:if>

                              <!--HEADINGS - FIELD 4-->

                              <xsl:if test="FieldAttributes/Field4ShowFlag = ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 6px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;">
                                  <xsl:choose>
                                    <xsl:when test="FieldAttributes/Field4Align = ''R''">
                                      <xsl:attribute name="align">Right</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field4Label" />
                                    </xsl:when>
                                    <xsl:otherwise>
                                      <xsl:attribute name="align">Left</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field4Label" />
                                    </xsl:otherwise>
                                  </xsl:choose>
                                 </th>
                              </xsl:if>

                              <!--HEADINGS - FIELD 5-->

                              <xsl:if test="FieldAttributes/Field5ShowFlag = ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;">
                                  <xsl:choose>
                                    <xsl:when test="FieldAttributes/Field5Align = ''R''">
                                      <xsl:attribute name="align">Right</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field5Label" />
                                    </xsl:when>
                                    <xsl:otherwise>
                                      <xsl:attribute name="align">Left</xsl:attribute>
                                      <xsl:value-of select="FieldAttributes/Field5Label" />
                                    </xsl:otherwise>
                                  </xsl:choose>
                                 </th>
                              </xsl:if>

                              <!--HEADINGS - COST-->

                              <xsl:if test="FieldAttributes/CostAllocationShowFlag= ''Y''">
                                <th align="left" style="font-size: 13px;line-height: 20px;font-weight: normal;padding-top: 0px;padding-right: 0px;padding-bottom: 0px;padding-left: 6px;color: #666;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: none;border-right-style: none;border-bottom-style: solid;border-left-style: solid;border-top-color: #F2f2f2;border-right-color: #F2f2f2;border-bottom-color: #F2f2f2;border-left-color: #F2f2f2;"> <xsl:value-of select="FieldAttributes/CostAllocationLabel" /> </th>
                              </xsl:if>
                            </tr>

' || '
                            <xsl:for-each select="Entries/Entry">

                              <!--START VALUES -->

                              <tr style="padding:0px; margin:0;">

                                <!--EntryChangedStatus-->
                                <td style="font-size: 5px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:0px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid; border-left-color: #F2f2f2;">
                                  <xsl:if test="InsUpdDel = ''U''">
                                    <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; background-color: #eeeeee;</xsl:attribute>
                                    <img>
                                      <xsl:attribute name="src"> <xsl:value-of select="/Notification/Header/UpdateImageUrl" /> </xsl:attribute>
                                    </img>
                                  </xsl:if>
                                  <xsl:if test="InsUpdDel = ''D''">
                                    <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; background-color: #eeeeee;</xsl:attribute>
                                    <img>
                                      <xsl:attribute name="src"> <xsl:value-of select="/Notification/Header/DeleteImageUrl" /> </xsl:attribute>
                                    </img>
                                  </xsl:if>
                                </td>

                                <!--DATE-->

                                <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid; border-left-color: #F2f2f2;">
                                  <xsl:choose>
                                    <xsl:when test="InsUpdDel = ''D''">
                                      <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; background-color: #eeeeee; color:#999999;</xsl:attribute>
                                      <s><xsl:value-of select="EntryDate" /></s>
                                    </xsl:when>
                                    <xsl:otherwise>
                                      <xsl:value-of select="EntryDate" />
                                    </xsl:otherwise>
                                  </xsl:choose>
                                </td>

                                <!--DURATION -->

                                <xsl:if test="../../FieldAttributes/DurationShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s> <xsl:value-of select="DurationHours"/></s> <span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="DurationHoursPrev"/></s> </span>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and DurationHours != DurationHoursPrev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="DurationHours"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="DurationHoursPrev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="DurationHours"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--START TIME -->

                                <xsl:if test="../../FieldAttributes/StartTimeShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="StartTime"/></s><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="StartTimePrev"/></s></span>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and StartTime != StartTimePrev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="StartTime"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="StartTimePrev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="StartTime"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--END TIME -->

                                <xsl:if test="../../FieldAttributes/EndTimeShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="EndTime"/></s><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="EndTimePrev"/></s></span>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and EndTime != EndTimePrev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="EndTime"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="EndTimePrev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="EndTime"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--Field 1 -->

                                <xsl:if test="../../FieldAttributes/Field1ShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="../../FieldAttributes/Field1Align = ''R''">
                                        <xsl:attribute name="align">Right</xsl:attribute>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:attribute name="align">Left</xsl:attribute>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="Field1"/></s>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and Field1 != Field1Prev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="Field1"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="Field1Prev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="Field1"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--Field 2 -->

                                <xsl:if test="../../FieldAttributes/Field2ShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="../../FieldAttributes/Field2Align = ''R''">
                                        <xsl:attribute name="align">Right</xsl:attribute>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:attribute name="align">Left</xsl:attribute>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="Field2"/></s>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and Field2 != Field2Prev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="Field2"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="Field2Prev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="Field2"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--Field 3 -->

                                <xsl:if test="../../FieldAttributes/Field3ShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="../../FieldAttributes/Field3Align = ''R''">
                                        <xsl:attribute name="align">Right</xsl:attribute>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:attribute name="align">Left</xsl:attribute>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="Field3"/></s>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and Field3 != Field3Prev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="Field3"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="Field3Prev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="Field3"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--Field 4 -->

                                <xsl:if test="../../FieldAttributes/Field4ShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="../../FieldAttributes/Field4Align = ''R''">
                                        <xsl:attribute name="align">Right</xsl:attribute>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:attribute name="align">Left</xsl:attribute>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="Field4"/></s>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and Field4 != Field4Prev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="Field4"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="Field4Prev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="Field4"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--Field 5 -->

                                <xsl:if test="../../FieldAttributes/Field5ShowFlag = ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="../../FieldAttributes/Field5Align = ''R''">
                                        <xsl:attribute name="align">Right</xsl:attribute>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:attribute name="align">Left</xsl:attribute>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s><xsl:value-of select="Field5"/></s>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and Field5 != Field5Prev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="Field5"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="Field5Prev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="Field5"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>

                                <!--Cost Allocation -->

                                <xsl:if test="../../FieldAttributes/CostAllocationShowFlag= ''Y''">
                                  <td style="font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;">
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2;background-color: #eeeeee; color:#999999;</xsl:attribute>
                                        <s> <xsl:value-of select="CostAllocationKeyflex"/></s> <span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="CostAllocationKeyflexPrev"/></s> </span>
                                      </xsl:when>
                                      <xsl:when test="InsUpdDel = ''U'' and CostAllocationKeyflex != CostAllocationKeyflexPrev">
                                        <xsl:attribute name="style">font-size: 17px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; background-color: #eeeeee;</xsl:attribute>
                                        <xsl:value-of select="CostAllocationKeyflex"/><span style=" font-weight:normal;padding-left:5px; color:#999999;"> <s><xsl:value-of select="CostAllocationKeyflexPrev"/></s></span>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="CostAllocationKeyflex"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </xsl:if>
                              </tr>
                              <xsl:if test="Comments">
                                <tr>
                                  <td colspan="11" style="font-size:12px; color:#FF0000; line-height:16px; padding-right: 0px; padding-left: 6px;">
                                    <xsl:choose>
                                      <xsl:when test="InsUpdDel = ''D''">
                                        <xsl:attribute name="style">font-size:12px; border-top:solid; border-top-color:#F2f2f2; border-top-width:1px; font-weight: normal; margin:3 0 3 0; padding-top:0px; padding-left:6px;padding-bottom:0px; padding-right:0px; border-left-width: 1px; border-left-style: solid;border-left-color: #F2f2f2; line-height:16px; background-color: #eeeeee; </xsl:attribute>
                                        <s><xsl:value-of select="Comments"/></s>
                                      </xsl:when>
                                      <xsl:otherwise>
                                        <xsl:value-of select="Comments"/>
                                      </xsl:otherwise>
                                    </xsl:choose>
                                  </td>
                                </tr>
                              </xsl:if>
                            </xsl:for-each>
                          </table>
                          <br />
                        </xsl:for-each>
                      </xsl:for-each>

                      <!--Detail Tables-->

                      <!--Customer hook start - for Post Detail HTML-->

                      <!--${FND_MESSAGE.XXAS.XXAS_TCM_POST_DETAIL_HTML}-->

                      <!--Customer hook end   - for Post Detail HTML-->
                    </td>
                  </tr>
                </table></td>
            </tr>

            <!--Footer-->

            <!--tr style="background:#0b172f; color:#FFFFFF;">
              <td height="48" style="padding:15px ;margin:0;"><table width="100%%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td style="text-align:center;"><a style="color:#0099FF; font-family:-apple-system, BlinkMacSystemFont, ''Segoe UI'', Roboto, Helvetica, Arial, sans-serif; text-align:center;">
                      <xsl:attribute name="href"> <xsl:value-of select="Notification/Header/TimecardUrl" /> </xsl:attribute>
                      Access timecards </a></td>
                  </tr>
                </table></td>
            </tr-->
          </table></td>
      </tr>
    </table>
    </body>
    </html>
  </xsl:template>
</xsl:stylesheet>';


  dbms_lob.createtemporary(l_blob,TRUE);

  dbms_lob.convertToBlob(dest_lob       => l_blob
                        ,src_clob       => l_clob
                        ,amount         => dbms_lob.lobmaxsize
                        ,dest_offset    => l_dest_offsset
                        ,src_offset     => l_src_offsset
                        ,blob_csid      => dbms_lob.default_csid
                        ,lang_context   => l_lang_context
                        ,warning        => l_warning);

  INSERT INTO fnd_lobs
        (file_id
        ,file_name
        ,file_content_type
        ,file_data
        ,upload_date
        ,expiration_date
        ,program_name
        ,program_tag
        ,language
        ,oracle_charset
        ,file_format)
  VALUES(fnd_lobs_s.nextval
        ,l_XSL_NAME
        ,'text/xml'
        ,l_blob
        ,null
        ,null
        ,''
        ,''
        ,'US'
        ,'UTF8'
        ,'text');

  dbms_lob.freetemporary(l_blob);
  
END;
/
COMMIT;
EXIT;
