<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:param name="sortOrder" select="descending"/>
<xsl:param name="logLevel" select="6"/>
<xsl:param name="enrollment" select="true()"/>
<xsl:param name="certManagement" select="true()"/>
<xsl:param name="symmCSP" select="true()"/>
<xsl:param name="enhancedCSP" select="true()"/>
<xsl:param name="certRevocation" select="true()"/>
<xsl:param name="archiveFormat" select="true()"/>
<xsl:param name="eels" select="true()"/>
<xsl:param name="epf" select="true()"/>
<xsl:param name="PKCS7" select="true()"/>
<xsl:param name="systemTray" select="true()"/>
<xsl:param name="MIME" select="true()"/>
<xsl:param name="certPathValidation" select="true()"/>
<xsl:param name="ComputerDigitalIDService" select="true()"/>
<xsl:param name="outlookCommon" select="true()"/>
<xsl:param name="smimeOutlook" select="true()"/>
<xsl:param name="entrustOutlook" select="true()"/>
<xsl:param name="networkTransport" select="true()"/>
<xsl:param name="ocsp" select="true()"/>
<xsl:param name="certDownload" select="true()"/>
<xsl:param name="autoEnroll" select="true()"/>
<xsl:param name="storeFind" select="true()"/>
<xsl:param name="decryptFileHandler" select="true()"/>
<xsl:param name="iisNotifyPlugin" select="true()"/>
<xsl:param name="matrixNotifyPlugin" select="true()"/>
<xsl:param name="nativeOutlookNotifyPlugin" select="true()"/>
<xsl:param name="efsNotifyPlugin" select="true()"/>
<xsl:param name="ciscoVPNNotifyPlugin" select="true()"/>
<xsl:param name="cardMSUpdater" select="true()"/>
<xsl:param name="compatibilityToolkit" select="true()"/>
<xsl:param name="certExplorer" select="true()"/>
<xsl:param name="defaultCSP" select="true()"/>
<xsl:param name="certPathPolicy" select="true()"/>
<xsl:param name="dirSearch" select="true()"/>
<xsl:param name="showLevel" select="true()"/>
<xsl:param name="showDate" select="true()"/>
<xsl:param name="showTime" select="true()"/>
<xsl:param name="showComponent" select="true()"/>
<xsl:param name="showProcessName" select="true()"/>
<xsl:param name="showProcessID" select="true()"/>
<xsl:param name="showThreadID" select="true()"/>
<xsl:param name="showSessionID" select="false()"/>
<xsl:param name="showEventID" select="true()"/>
<xsl:param name="showMessage" select="true()"/>
<xsl:param name="firstEvent" select="1"/>
<xsl:param name="lastEvent" select="1"/>
<xsl:param name="viewFromEventDate" select="0"/>
<xsl:param name="viewToEventDate" select="0"/>
<xsl:param name="viewFromEventTime" select="0"/>
<xsl:param name="viewToEventTime" select="0"/>

<xsl:template match="systemInfo">
<table border="0" cellspacing="1" cellpadding="1">
  <tr>
    <th align = "left">Operating System:&#160;</th>
    <td>
      <xsl:value-of select="os"/>&#160;
      <xsl:value-of select="os/@servicepack"/>
    </td>
  </tr>

  <tr>
    <th align = "left">Computer Name:</th>
    <td>
      <xsl:value-of select="computerName"/>
    </td>
  </tr>

  <tr>
    <th align = "left">System:</th>
    <td>
      <xsl:value-of select="memorySize"/>
    </td>
  </tr>

  <tr>
    <td></td>
    <td>
      <xsl:value-of select="diskSpace"/>
    </td>
  </tr>
  
  <tr>
    <td></td>
    <td>
      <xsl:value-of select="cpu"/>
    </td>
  </tr>
  <tr>
    <th align = "left">IE Version:</th>
    <td>
      <xsl:value-of select="ieVersion"/>
    </td>
  </tr>
  <tr>
    <th align = "left">Application Version:</th>
    <td>
      <xsl:value-of select="appVersion"/>
    </td>
  </tr>
</table>
<br />
<br />
</xsl:template>

<xsl:template match="logFile">
<table border="1" cellspacing="0" cellpadding="1">
  <tr>
    <xsl:if test="$showLevel">
      <th>Type</th>
    </xsl:if>

    <xsl:if test="$showDate">
      <th>Date</th>
    </xsl:if>

    <xsl:if test="$showTime">
      <th>Time</th>
    </xsl:if>

    <xsl:if test="$showComponent">
      <th>Component</th>
    </xsl:if>

    <xsl:if test="$showProcessName">
      <th>Process Name</th>
    </xsl:if>

    <xsl:if test="$showProcessID">
      <th>Process ID</th>
    </xsl:if>

    <xsl:if test="$showThreadID">
      <th>Thread ID</th>
    </xsl:if>

    <xsl:if test="$showSessionID">
      <th>Session ID</th>
    </xsl:if>

    <xsl:if test="$showEventID">
      <th>Event ID</th>
    </xsl:if>

    <xsl:if test="$showMessage">
      <th>Message</th>
    </xsl:if>
  </tr>
  <xsl:apply-templates select="logEntry">
    <xsl:sort select="date and date/@time" order="{$sortOrder}"/>
  </xsl:apply-templates>
</table>
</xsl:template>


<xsl:template match="logEntry">
  <xsl:variable name="viewM" select="substring(date,1,2)"/>
  <xsl:variable name="viewD" select="substring(date,4,2)"/>
  <xsl:variable name="viewY" select="substring(date,7,4)"/>
  <xsl:variable name="viewH" select="substring(date/@time,1,2)"/>
  <xsl:variable name="viewMI" select="substring(date/@time,4,2)"/>
  <xsl:variable name="viewS" select="substring(date/@time,7,2)"/>

  <xsl:variable name="viewFromM" select="substring($viewFromEventDate,1,2)"/>
  <xsl:variable name="viewFromD" select="substring($viewFromEventDate,4,2)"/>
  <xsl:variable name="viewFromY" select="substring($viewFromEventDate,7,4)"/>
  <xsl:variable name="viewFromH" select="substring($viewFromEventTime,1,2)"/>
  <xsl:variable name="viewFromMI" select="substring($viewFromEventTime,4,2)"/>
  <xsl:variable name="viewFromS" select="substring($viewFromEventTime,7,2)"/>

  <xsl:variable name="viewToM" select="substring($viewToEventDate,1,2)"/>
  <xsl:variable name="viewToD" select="substring($viewToEventDate,4,2)"/>
  <xsl:variable name="viewToY" select="substring($viewToEventDate,7,4)"/>
  <xsl:variable name="viewToH" select="substring($viewToEventTime,1,2)"/>
  <xsl:variable name="viewToMI" select="substring($viewToEventTime,4,2)"/>
  <xsl:variable name="viewToS" select="substring($viewToEventTime,7,2)"/>

  <xsl:variable name="conditionF1" select="$firstEvent='0' and $viewY &gt; $viewFromY"/>
  <xsl:variable name="conditionF2" select="$firstEvent='0' and $viewY=$viewFromY and $viewM &gt; $viewFromM"/>
  <xsl:variable name="conditionF3" select="$firstEvent='0' and $viewY=$viewFromY and $viewM=$viewFromM and $viewD &gt; $viewFromD"/>
  <xsl:variable name="conditionF4" select="$firstEvent='0' and $viewY=$viewFromY and $viewM=$viewFromM and $viewD=$viewFromD and $viewH &gt; $viewFromH"/>
  <xsl:variable name="conditionF5" select="$firstEvent='0' and $viewY=$viewFromY and $viewM=$viewFromM and $viewD=$viewFromD and $viewH=$viewFromH and $viewMI &gt; $viewFromMI"/>
  <xsl:variable name="conditionF6" select="$firstEvent='0' and $viewY=$viewFromY and $viewM=$viewFromM and $viewD=$viewFromD and $viewH=$viewFromH and $viewMI=$viewFromMI and $viewS &gt; $viewFromS"/>
  <xsl:variable name="conditionF7" select="$firstEvent='0' and $viewY=$viewFromY and $viewM=$viewFromM and $viewD=$viewFromD and $viewH=$viewFromH and $viewMI=$viewFromMI and $viewS=$viewFromS"/>

  <xsl:variable name="conditionT1" select="$lastEvent='0' and $viewY &lt; $viewToY"/>
  <xsl:variable name="conditionT2" select="$lastEvent='0' and $viewY=$viewToY and $viewM &lt; $viewToM"/>
  <xsl:variable name="conditionT3" select="$lastEvent='0' and $viewY=$viewToY and $viewM=$viewToM and $viewD &lt; $viewToD"/>
  <xsl:variable name="conditionT4" select="$lastEvent='0' and $viewY=$viewToY and $viewM=$viewToM and $viewD=$viewToD and $viewH &lt; $viewToH"/>
  <xsl:variable name="conditionT5" select="$lastEvent='0' and $viewY=$viewToY and $viewM=$viewToM and $viewD=$viewToD and $viewH=$viewToH and $viewMI &lt; $viewToMI"/>
  <xsl:variable name="conditionT6" select="$lastEvent='0' and $viewY=$viewToY and $viewM=$viewToM and $viewD=$viewToD and $viewH=$viewToH and $viewMI=$viewToMI and $viewS &lt; $viewToS"/>
  <xsl:variable name="conditionT7" select="$lastEvent='0' and $viewY=$viewToY and $viewM=$viewToM and $viewD=$viewToD and $viewH=$viewToH and $viewMI=$viewToMI and $viewS=$viewToS"/>

  <xsl:if test="@level &lt; $logLevel or @level=$logLevel">
    <xsl:if test="component/@id='1' and $enrollment or
                      component/@id='2' and $enrollment or
                      component/@id='3' and $enrollment or
                      component/@id='4' and $enrollment or
                      component/@id='5' and $certManagement or
                      component/@id='6' and $certManagement or
                      component/@id='7' and $certRevocation or
                      component/@id='8' and $archiveFormat or
                      component/@id='9' and $symmCSP or
                      component/@id='10' and $enhancedCSP or
                      component/@id='11' and $eels or
                      component/@id='12' and $epf or
                      component/@id='13' and $PKCS7 or
                      component/@id='14' and $systemTray or
                      component/@id='15' and $MIME or
                      component/@id='16' and $ComputerDigitalIDService or
                      component/@id='17' and $certPathValidation or
                      component/@id='19' and $ocsp or
                      component/@id='21' and $networkTransport or
                      component/@id='22' and $certDownload or
                      component/@id='23' and $decryptFileHandler or
                      component/@id='25' and $outlookCommon or
                      component/@id='30' and $smimeOutlook or
                      component/@id='35' and $entrustOutlook or
                      component/@id='40' and $autoEnroll or
                      component/@id='41' and $storeFind or
                      component/@id='45' and $iisNotifyPlugin or
                      component/@id='46' and $matrixNotifyPlugin or
                      component/@id='47' and $nativeOutlookNotifyPlugin or
                      component/@id='48' and $efsNotifyPlugin or
                      component/@id='49' and $ciscoVPNNotifyPlugin or
                      component/@id='52' and $compatibilityToolkit or
                      component/@id='53' and $defaultCSP or
                      component/@id='54' and $certExplorer or
                      component/@id='56' and $certPathPolicy or
                      component/@id='57' and $cardMSUpdater or
                      component/@id='58' and $dirSearch or
                      component/@id=''">

      <xsl:if test="$firstEvent='1' or $conditionF1 or $conditionF2 or $conditionF3 or $conditionF4 or $conditionF5 or $conditionF6 or $conditionF7">
        <xsl:if test="$lastEvent='1' or $conditionT1 or $conditionT2 or $conditionT3 or $conditionT4 or $conditionT5 or $conditionT6 or $conditionT7">
          <tr>
            <xsl:if test="$showLevel">
              <xsl:choose>
                <xsl:when test="@level='6'">
                  <td>Superdetailed</td>
                </xsl:when>

                <xsl:when test="@level='4'">
                  <td>Detailed</td>
                </xsl:when>

                <xsl:when test="@level='3'">
                  <td>Information</td>
                </xsl:when>

                <xsl:when test="@level='2'">
                  <td>Warning</td>
                </xsl:when>
  
                <xsl:when test="@level='1'">
                  <td>Error</td>
                </xsl:when>

                <xsl:otherwise>
                  <td>&#160;</td>
                </xsl:otherwise>

              </xsl:choose>
            </xsl:if>

            <xsl:if test="$showDate">
              <td><xsl:value-of select="date"/>&#160;</td>
            </xsl:if> 
          
            <xsl:if test="$showTime">
              <td><xsl:value-of select="date/@time"/>&#160;</td>
            </xsl:if> 

            <xsl:if test="$showComponent">
              <xsl:choose>
                <xsl:when test="component=''">
                  <xsl:choose>
                    <xsl:when test="component/@id='1' and $enrollment">
                      <td>Enrollment</td>
                    </xsl:when>
                    <xsl:when test="component/@id='2' and $enrollment">
                      <td>Enrollment PKIX</td>
                    </xsl:when>
                    <xsl:when test="component/@id='3' and $enrollment">
                      <td>Enrollment Manual EXE</td>
                    </xsl:when>
                    <xsl:when test="component/@id='4' and $enrollment">
                      <td>Enrollment MIME EXE</td>
                    </xsl:when>
                    <xsl:when test="component/@id='5'and $certManagement">
                      <td>Certificate Management DLL</td>
                    </xsl:when>
                    <xsl:when test="component/@id='6'and $certManagement">
                      <td>Digital ID Monitor</td>
                    </xsl:when>
                    <xsl:when test="component/@id='7' and $certRevocation">
                      <td>Certificate Revocation Verification</td>
                    </xsl:when>
                    <xsl:when test="component/@id='8' and $archiveFormat">
                      <td>Entrust Archive</td>
                    </xsl:when>
                    <xsl:when test="component/@id='9' and $symmCSP">
                      <td>Entrust Symmetric Cryptographic Provider</td>
                    </xsl:when>
                    <xsl:when test="component/@id='10' and $enhancedCSP">
                      <td>Entrust Enhanced Cryptographic Provider</td>
                    </xsl:when>
                    <xsl:when test="component/@id='11' and $eels">
                      <td>Login Service</td>
                    </xsl:when>
                    <xsl:when test="component/@id='12' and $epf">
                      <td>Entrust Security Store</td>
                    </xsl:when>
                    <xsl:when test="component/@id='13' and $PKCS7">
                      <td>Entrust PKCS #7</td>
                    </xsl:when>
                    <xsl:when test="component/@id='14' and $systemTray">
                      <td>Taskbar Status</td>
                    </xsl:when>
                    <xsl:when test="component/@id='15' and $MIME">
                      <td>Entrust MIME</td>
                    </xsl:when>
                    <xsl:when test="component/@id='16' and $ComputerDigitalIDService">
                      <td>Computer Digital ID Service</td>
                    </xsl:when>
                    <xsl:when test="component/@id='17' and $certPathValidation">
                      <td>Certificate Path Validation</td>
                    </xsl:when>
                    <xsl:when test="component/@id='19' and $ocsp">
                      <td>OCSP Revocation Provider</td>
                    </xsl:when>
                    <xsl:when test="component/@id='21' and $networkTransport">
                      <td>Entrust Network Transport</td>
                    </xsl:when>
                    <xsl:when test="component/@id='22' and $certDownload">
                      <td>Automatic Additional Certificate Download</td>
                    </xsl:when>
                    <xsl:when test="component/@id='23' and $decryptFileHandler">
                      <td>Decrypt File Handler</td>
                    </xsl:when>
                   <xsl:when test="component/@id='25' and $outlookCommon">
                      <td>ESP for Outlook Common</td>
                    </xsl:when>
                    <xsl:when test="component/@id='30' and $smimeOutlook">
                      <td>ESP for Outlook (S/MIME)</td>
                    </xsl:when>
                    <xsl:when test="component/@id='35'and $entrustOutlook">
                      <td>ESP for Outlook (Entrust)</td>
                    </xsl:when>
                    <xsl:when test="component/@id='40'and $autoEnroll">
                      <td>Automatic Enrollment</td>
                    </xsl:when>
                    <xsl:when test="component/@id='41'and $storeFind">
                      <td>Entrust CA Certificate Store Find Provider</td>
                    </xsl:when>
                    <xsl:when test="component/@id='45'and $iisNotifyPlugin">
                      <td>IIS Notify Plug-in</td>
                    </xsl:when>
                    <xsl:when test="component/@id='46'and $matrixNotifyPlugin">
                      <td>Security Provider for Outlook Notify Plug-in</td>
                    </xsl:when>
                    <xsl:when test="component/@id='47'and $nativeOutlookNotifyPlugin">
                      <td>Native Outlook Security Notify Plug-in</td>
                    </xsl:when>
                    <xsl:when test="component/@id='48'and $efsNotifyPlugin">
                      <td>EFS Notify Plug-in</td>
                    </xsl:when>
                    <xsl:when test="component/@id='49'and $ciscoVPNNotifyPlugin">
                      <td>Cisco VPN Client Notify Plug-in</td>
                    </xsl:when>
                    <xsl:when test="component/@id='52'and $compatibilityToolkit">
                      <td>Entrust ESP Compatibility Toolkit</td>
                    </xsl:when>
                    <xsl:when test="component/@id='53'and $defaultCSP">
                      <td>Entrust Default Cryptographic Provider</td>
                    </xsl:when>
                    <xsl:when test="component/@id='54'and $certExplorer">
                      <td>Entrust Certificate Explorer</td>
                    </xsl:when>
                    <xsl:when test="component/@id='56'and $certPathPolicy">
                      <td>Entrust Basic Certificate Path Policy Provider</td>
                    </xsl:when>
                    <xsl:when test="component/@id='57'and $cardMSUpdater">
                      <td>CardMS Updater</td>
                    </xsl:when>
                    <xsl:when test="component/@id='58'and $dirSearch">
                      <td>Directory Search</td>
                    </xsl:when>
                    <xsl:otherwise>
                      <td>&#160;</td>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:when>
                <xsl:otherwise>
                  <td><xsl:value-of select="component"/>&#160;</td>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:if> 

            <xsl:if test="$showProcessName">
              <td><xsl:value-of select="processID/@name"/>&#160;</td>
            </xsl:if> 

            <xsl:if test="$showProcessID">
              <td><xsl:value-of select="processID"/>&#160;</td>
            </xsl:if> 

            <xsl:if test="$showThreadID">
              <td><xsl:value-of select="threadID"/>&#160;</td>
            </xsl:if> 

            <xsl:if test="$showSessionID">
              <td><xsl:value-of select="sessionID"/>&#160;</td>
            </xsl:if> 

            <xsl:if test="$showEventID">
              <td><xsl:value-of select="message/@eventID"/>&#160;</td>
            </xsl:if> 

            <xsl:if test="$showMessage">
              <td><xsl:value-of select="message"/>&#160;</td>
            </xsl:if>
          </tr>
        </xsl:if>
      </xsl:if> 
    </xsl:if>
  </xsl:if>
</xsl:template>
</xsl:stylesheet>





