MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/rdbms/xml/em/orarep/exadata/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/rdbms/xml/em/orarep/exadata/exadataHtml.xsl

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">

  <xsl:output method="html"/>

  <!-- constants -->
  <xsl:variable name="NAME_ALL">
    <xsl:value-of select="'All'"/>
  </xsl:variable>
  <!-- unit types for displaying numbers with units -->
  <xsl:variable name="UNIT_SEC">
    <xsl:value-of select="'sec'"/>
  </xsl:variable>
  <xsl:variable name="UNIT_BYTE">
    <xsl:value-of select="'byte'"/>
  </xsl:variable>
  <xsl:variable name="UNIT_NUMK">
    <xsl:value-of select="'numK'"/>
  </xsl:variable>
  <xsl:variable name="UNIT_NONE">
    <xsl:value-of select="'none'"/>
  </xsl:variable>

  <xsl:variable name="EMPTY_STRING">
    <xsl:value-of select="''"/>
  </xsl:variable>
  <!--  variables  from XML -->
  <xsl:variable name="showDiskOutliers" select="/report/capacity/@show_disk_outliers"/>
  <xsl:variable name="showFlashOutliers" select="/report/capacity/@show_flash_outliers"/>
  <xsl:variable name="showCpuOutliers" select="/report/capacity/@show_cpu_outliers"/>
  <xsl:variable name="thresholdDiskIOPs" select="/report/capacity/threshold/@diops"/>
  <xsl:variable name="thresholdFlashIOPs" select="/report/capacity/threshold/@fiops"/>
  <xsl:variable name="thresholdCpu" select="/report/capacity/threshold/@cpu"/>
  <xsl:variable name="thresholdIdleIOPs" select="/report/capacity/threshold/@idle"/>
  <xsl:variable name="maxDiskIOPs" select="format-number(/report/capacity/max/@diops,'##,###,###')"/>
  <xsl:variable name="maxFlashIOPs" select="format-number(/report/capacity/max/@fiops,'##,###,###')"/>
  <xsl:variable name="currDiskIOPs" select="format-number(/report/capacity/curr/@diops,'##,###,###')"/>
  <xsl:variable name="currFlashIOPs" select="format-number(/report/capacity/curr/@fiops,'##,###,###')"/>
  <xsl:variable name="currCpu" select="format-number(/report/capacity/curr/@cpu,'##,##,###.##')"/>
  <xsl:variable name="pctThreshold" select="/report/capacity/@threshold"/>
  <xsl:variable name="topN" select="/report/capacity/topn"/>
  <xsl:variable name="topReason" select="/report/capacity/tops/ioreason/@topn"/>
  <xsl:variable name="pctReason" select="/report/capacity/tops/ioreason/@pct"/>
  <xsl:variable name="topDbs" select="/report/capacity/tops/dbs/@topn"/>
  <xsl:variable name="topDbPerCell" select="/report/capacity/tops/dbs/@percell"/>

  <xsl:variable name="cellThreshold" select="/report/outlier_summary[@type='cell']/@threshold"/>
  <xsl:variable name="diskThreshold" select="/report/outlier_summary[@type='disk']/@threshold"/>
  <xsl:variable name="maxCellVersion" select="//capacity/cell_version"/>
  <!-- call template to allow for multiple values in a heterogeneous cells -->
  <xsl:variable name="cellMaxDiskIOPs">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'H'"/>
      <xsl:with-param name="nodeName" select="'cell_iops'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="cellMaxFlashIOPs">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'F'"/>
      <xsl:with-param name="nodeName" select="'cell_iops'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="diskMaxDiskIOPs">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'H'"/>
      <xsl:with-param name="nodeName" select="'iops'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="diskMaxFlashIOPs">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'F'"/>
      <xsl:with-param name="nodeName" select="'iops'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="cellMaxDiskMBPS">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'H'"/>
      <xsl:with-param name="nodeName" select="'cell_mbps'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="cellMaxFlashMBPS">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'F'"/>
      <xsl:with-param name="nodeName" select="'cell_mbps'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="diskMaxDiskMBPS">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'H'"/>
      <xsl:with-param name="nodeName" select="'mbps'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="diskMaxFlashMBPS">
    <xsl:call-template name="setMaxCapacity">
      <xsl:with-param name="diskType" select="'F'"/>
      <xsl:with-param name="nodeName" select="'mbps'"/>
    </xsl:call-template>
  </xsl:variable>
  <xsl:variable name="minReportIntervalMsg">
    <xsl:choose>
      <xsl:when test="//warning[@type='-REPORT_INTERVAL']">
        <xsl:value-of select="//warning[@type='-REPORT_INTERVAL']"/>        
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!-- determine if we've allocated FC for FFI or FCLogger -->
  <xsl:variable name="showFcSpaceOther">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_space']/cell[@name=$NAME_ALL]/stat[@name='fciop']/@ffi or //cellstats[@type='fc_space']/cell[@name=$NAME_ALL]/stat[@name='fciop']/@fcl">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!-- determine if we have the proper version to breakdown space alloc -->
  <xsl:variable name="showFcSpaceDetail">
    <xsl:choose>
      <xsl:when test="translate(//capacity/cell_version,'.','') &lt; translate('12.1.2.2.0','.','')">
        <xsl:value-of select="'N'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'Y'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!-- determine if we have partial writes                           -->
  <!-- NOTE, both requests and bytes have to be non-zero             -->
  <!-- this works around issues where we have bytes but not requests -->
  <xsl:variable name="showFcPartialWrites">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_uwrites']/cell[@name=$NAME_ALL]/stat[@name='fciowp']/@rq &gt; 0 and //cellstats[@type='fc_uwrites']/cell[@name=$NAME_ALL]/stat[@name='fciowp']/@mb &gt; 0">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!-- determine if we have new disk writer stats-->
  <xsl:variable name="showDiskWriter">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_ireads']/cell[@name=$NAME_ALL]/stat[@name='fciordkwr'] or //cellstats[@type='fc_ireads']/cell[@name=$NAME_ALL]/stat[@name='fciowdkwr']">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <!-- determine if we have trim stats-->
  <xsl:variable name="showFcTrims">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_iwrites']/cell[@name=$NAME_ALL]/stat[@name='fciowtrim']">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- if we have EF in the mix -->
  <xsl:variable name="hasEF">
    <xsl:choose>
      <xsl:when test="contains(//configs[@type='makemodel']/config/make,'EXTREME_FLASH')">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- if we have RAM Cache -->
  <!-- . if we have cells for any of the new rc_* types -->
  <!-- we do not want to display the new sections(yet) when on release -->
  <xsl:variable name="hasRamCache">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='rc_ureads']/cell or 
      //cellstats[@type='rc_iwrites']/cell or
      //cellstats[@type='rc_scp']/cell">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- if we have PMEM devices -->
  <!-- . fc_summary has a pmem child -->
  <!-- . config has an disktype that starts with M -->
  <!-- . osstat or cellsrvstat have disk types that start with M -->
  <xsl:variable name="hasPmem">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_summary']/pmem or
                      (//configs[@type='storage']/config[@pmemdisks] and //configs[@type='storage']/config/@pmemdisks &gt; 0) or
                      substring(//configs[@type='celldisk']/config[@disk_type],1,1) = 'M' or
                      substring(//outliers[@type='cell_osstat']/cells[@disk_type],1,1) = 'M' or
                      substring(//configs[@type='celldisk']/config[@disk_type],1,1) = 'X' or
                      substring(//outliers[@type='cell_osstat']/cells[@disk_type],1,1) = 'X'">

        <xsl:value-of select="'Y'"/>        
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- if we need to display a warning for asm diskgroups -->
  <xsl:variable name="hasMissingDisk">
    <xsl:choose>
      <xsl:when test="//configs[@type='asm_diskgroup']/config[@missing_disk='Y']">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="hasDbRqDetail">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='topdb']/db/stat[@name='rq']/rqs">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="hasFlashCacheLW">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_uwrites']/cell[@name=$NAME_ALL]/stat[@name='fclwrow'] 
                      or //cellstats[@type='fc_uwrites']/cell[@name=$NAME_ALL]/stat[@name='fclwmrw'] 
                      or //cellstats[@type='fc_uwrites']/cell[@name=$NAME_ALL]/stat[@name='fclwnrw']"> 
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="outlierString">
    <xsl:value-of select="'Outlier'"/>
  </xsl:variable>
  <xsl:variable name="osCollectionMessage">
    <xsl:value-of select="'These statistics are collected by the OS on the cells and are not restricted to this database or instance'"/>
  </xsl:variable>
  <xsl:variable name="cellCollectionMessage">
    <xsl:value-of select="'These statistics are collected by the cells and are not restricted to this database or instance'"/>
  </xsl:variable>
  <xsl:variable name="diskTypeMessage">
    <xsl:choose>
      <xsl:when test="$hasPmem = 'Y'">
        <xsl:value-of select="'Disk Type &lt;F|H|M&gt;/&lt;size&gt;: F-Flash, H-Hard Disk, M-Persistent Memory; Persistent Memory I/O only include remote I/Os processed by cellsrv'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'Disk Type &lt;F|H&gt;/&lt;size&gt;: F-Flash, H-Hard Disk'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <xsl:variable name="diskTypeMessageConfig">
    <xsl:choose>
      <xsl:when test="$hasPmem = 'Y'">
        <xsl:value-of select="'Disk Type &lt;F|H|M&gt;/&lt;size&gt;: F-Flash, H-Harddisk, M-Persistent Memory'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'Disk Type &lt;F|H&gt;/&lt;size&gt;: F-Flash, H-Harddisk'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>


  <xsl:variable name="noDataMsg" select="'No data exists for this section of the report.'"/>

  <!-- section titles -->
  <xsl:variable name="titleExaResourceStat" select="'Exadata Resource Statistics'"/>
  <xsl:variable name="titleExaOutlierSumm" select="'Exadata Outlier Summary'"/>
  <xsl:variable name="titleExaOsOutlierStat" select="'Exadata OS Statistics Outliers'"/>
  <xsl:variable name="titleExaCellSrvOutlierStat" select="'Exadata Cell Server Statistics Outliers'"/>
  <xsl:variable name="titleExaOsTopStat" select="'Exadata OS Statistics Top'"/>
  <xsl:variable name="titleExaCellSrvTopStat" select="'Exadata Cell Server Statistics Top'"/>
  <xsl:variable name="titleExaOutlierDetails" select="'Exadata Outlier Details'"/>
  <xsl:variable name="titleExaOsOutlierDetails" select="'Exadata OS Statistics Outlier Details'"/>
  <xsl:variable name="titleExaCellSrvOutlierDetails" select="'Exadata Cell Server Statistics Outlier Details'"/>

  <!-- variables for link anchors -->
  <!-- outlier sections -->
  <xsl:variable name="linkOsIoOutCell" select="'OS_IO_CELL_'"/>
  <xsl:variable name="linkOsIoOutDisk" select="'OS_IO_DISK_'"/>
  <xsl:variable name="linkOsLatencyOutCell" select="'OS_LATENCY_CELL_'"/>
  <xsl:variable name="linkOsLatencyOutDisk" select="'OS_LATENCY_DISK_'"/>
  <xsl:variable name="linkOsCpuOutCell" select="'OS_CPU_CELL_'"/>
  <xsl:variable name="linkCellSrvIopsOutCell" select="'CELLSRV_IOPS_CELL_'"/>
  <xsl:variable name="linkCellSrvIopsOutDisk" select="'CELLSRV_IOPS_DISK_'"/>
  <xsl:variable name="linkCellSrvMbpsOutCell" select="'CELLSRV_MBPS_CELL_'"/>
  <xsl:variable name="linkCellSrvMbpsOutDisk" select="'CELLSRV_MBPS_DISK_'"/>
  <xsl:variable name="linkCellSrvLatencyOutCell" select="'CELLSRV_LATENCY_CELL_'"/>
  <xsl:variable name="linkCellSrvLatencyOutDisk" select="'CELLSRV_LATENCY_DISK_'"/>
  <!-- outlier details -->
  <xsl:variable name="linkOsOutDetailCell" select="'OS_OUTLIER_DETAIL_CELL_'"/>
  <xsl:variable name="linkOsOutDetailDisk" select="'OS_OUTLIER_DETAIL_DISK_'"/>
  <xsl:variable name="linkCellSrvOutDetailCell" select="'CELLSRV_OUTLIER_DETAIL_CELL_'"/>
  <xsl:variable name="linkCellSrvOutDetailDisk" select="'CELLSRV_OUTLIER_DETAIL_DISK_'"/>
  <!-- top sections -->
  <xsl:variable name="linkOsIoTopCell" select="'OS_IO_CELL_TOP_'"/>
  <xsl:variable name="linkOsIoTopDisk" select="'OS_IO_DISK_TOP_'"/>
  <xsl:variable name="linkOsLatencyTopCell" select="'OS_LATENCY_CELL_TOP_'"/>
  <xsl:variable name="linkOsLatencyTopDisk" select="'OS_LATENCY_DISK_TOP_'"/>
  <xsl:variable name="linkOsCpuTopCell" select="'OS_CPU_CELL_TOP_'"/>
  <xsl:variable name="linkCellSrvIopsTopCell" select="'CELLSRV_IOPS_CELL_TOP_'"/>
  <xsl:variable name="linkCellSrvIopsTopDisk" select="'CELLSRV_IOPS_DISK_TOP_'"/>
  <xsl:variable name="linkCellSrvMbpsTopCell" select="'CELLSRV_MBPS_CELL_TOP_'"/>
  <xsl:variable name="linkCellSrvMbpsTopDisk" select="'CELLSRV_MBPS_DISK_TOP_'"/>
  <xsl:variable name="linkCellSrvLatencyTopCell" select="'CELLSRV_LATENCY_CELL_TOP_'"/>
  <xsl:variable name="linkCellSrvLatencyTopDisk" select="'CELLSRV_LATENCY_DISK_TOP_'"/>

  <!--  helper functions  -->

  <!-- ========================================================== -->
  <!-- NAME: formatNumber                                         -->
  <!-- DESCRIPTION: Formatting numbers with two decimal places    -->
  <!-- ========================================================== -->
  <xsl:template name="formatNumber">
    <xsl:param name="n"/>
    <xsl:param name="decimalPoints" select="'Y'"/>
    <xsl:param name="blankToZero" select="'N'"/>
    
    <xsl:choose>
      <xsl:when test="$n and $n != '' and $decimalPoints='Y'">
        <xsl:value-of select="format-number(number($n),'##,###,##0.00')"/>
      </xsl:when>
      <xsl:when test="$n and $n != '' and $decimalPoints='N'">
        <xsl:value-of select="format-number(number($n),'##,###,##0')"/>
      </xsl:when>
      <xsl:when test="($n = '' or $n = 0) and $blankToZero = 'Y' and $decimalPoints='Y'">
        <xsl:value-of select="'0.00'"/>
      </xsl:when>
      <xsl:when test="($n = '' or $n = 0) and $blankToZero = 'Y' and $decimalPoints='N'">
        <xsl:value-of select="'0'"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="@*" mode="number">
    <xsl:value-of select="format-number(number(.),'##,###,##0.00')"/>    
  </xsl:template>

  <xsl:template match="@*" mode="int">
    <xsl:value-of select="format-number(number(.),'##,###,##0')"/>
  </xsl:template>

  <xsl:template match="*" mode="number">
    <xsl:value-of select="format-number(number(.),'##,###,##0.00')"/>    
  </xsl:template>

  <xsl:template match="*" mode="int">
    <xsl:value-of select="format-number(number(.),'##,###,##0')"/>    
  </xsl:template>


  <!-- ============================================================ -->
  <!-- NAME: formatValue                                            -->
  <xsl:template match="@*" mode="formatValue">
    <xsl:param name="statUnit" select="$UNIT_NONE"/>
    <xsl:param name="toUnit" select="$EMPTY_STRING"/>
    <xsl:choose>
      <xsl:when test="$statUnit = $UNIT_SEC">
        <xsl:apply-templates select="." mode="formatMs">
          <xsl:with-param name="toUnit" select="$toUnit"/>          
        </xsl:apply-templates>
      </xsl:when>
      <xsl:when test="$statUnit = $UNIT_BYTE">
        <xsl:apply-templates select="." mode="formatMB">
          <xsl:with-param name="toUnit" select="$toUnit"/>          
        </xsl:apply-templates>
      </xsl:when>
      <xsl:when test="$statUnit = $UNIT_NUMK">
        <xsl:apply-templates select="." mode="formatK">
          <xsl:with-param name="toUnit" select="$toUnit"/>          
        </xsl:apply-templates>
      </xsl:when>
      <xsl:otherwise>
        <xsl:apply-templates select="." mode="number"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- NAME: formatMs                                             -->
  <!-- DESCRIPTION: converts ms to either s, ms, us or ns         -->
  <!--              appends unit to display                       -->
  <!-- ========================================================== -->
  <xsl:template match="@*" mode="formatMs">
    <xsl:param name="toUnit" select="$EMPTY_STRING"/>

    <xsl:variable name="newUnit">
      <xsl:choose>
        <xsl:when test="$toUnit = '' or $toUnit = $UNIT_NONE">
          <xsl:apply-templates select="." mode="getMsUnit"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$toUnit"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$newUnit = 'ms'">
        <xsl:value-of select="concat(format-number(.,'##,###,##0.00'),'ms')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'us'">
        <xsl:value-of select="concat(format-number(. * 1000,'##,###,##0.00'),'us')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'ns'">
        <xsl:value-of select="concat(format-number(. * 1000000,'##,###,##0.00'),'ns')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 's'">
        <xsl:value-of select="concat(format-number(. div 1000,'##,###,##0.00'),'s')"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME: getMsUnit                                              -->
  <!-- DESCRIPTION: based on value of n (in ms), determines if we   -->
  <!--              should display s, ms, us, ns                    -->
  <!-- ============================================================ -->
  <xsl:template match="@*" mode="getMsUnit">
    <xsl:choose>
      <xsl:when test="number(.) &lt;= 0.000950">
        <xsl:value-of select="'ns'"/>
      </xsl:when>
      <xsl:when test="number(.) &lt;= 0.950">
        <xsl:value-of select="'us'"/>
      </xsl:when>
      <xsl:when test="number(.) &gt; 9500">
        <xsl:value-of select="'s'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'ms'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME: formatMB                                               -->
  <!-- DESCRIPTION: formats input (MB) into KB/MB/GB/TB/PB          -->
  <!-- ============================================================ -->
  <xsl:template match="@*" mode="formatMB">
    <xsl:param name="toUnit" select="$EMPTY_STRING"/>

    <xsl:variable name="newUnit">
      <xsl:choose>
        <xsl:when test="$toUnit = $EMPTY_STRING">
          <xsl:apply-templates select="." mode="getMBUnit"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$toUnit"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:choose>
      <xsl:when test="$newUnit = 'KB'">
        <xsl:value-of select="concat(format-number(. * 1024, '##,###,###0.00'),'KB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'GB'">
        <xsl:value-of select="concat(format-number(. div 1024, '##,###,##0.00'),'GB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'TB'">
        <xsl:value-of select="concat(format-number(. div (1024*1024), '##,###,##0.00'),'TB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'PB'">
        <xsl:value-of select="concat(format-number(. div (1024*1024*1024), '##,###,##0.00'),'PB')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="concat(format-number(., '##,###,##0.00'),'MB')"/>
      </xsl:otherwise>
    </xsl:choose>

  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME: getMBUnit                                              -->
  <!-- DESCRIPTION: determine unit to display based on input n      -->
  <!-- ============================================================ -->
  <xsl:template match="@*" mode="getMBUnit">
    <xsl:choose>
      <xsl:when test=". &lt; 1">
        <xsl:value-of select="'KB'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1024">
        <xsl:value-of select="'MB'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1024*1024">
        <xsl:value-of select="'GB'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1024*1024*1024">
        <xsl:value-of select="'TB'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1024*1024*1024*1024">
        <xsl:value-of select="'PB'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'MB'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME: formatK                                                -->
  <!-- DESCRIPTION: formats input into K/M/G/T/P                    -->
  <!-- ============================================================ -->
  <xsl:template match="@*" mode="formatK">
    <xsl:param name="toUnit" select="''"/>

    <xsl:variable name="newUnit">
      <xsl:choose>
        <xsl:when test="$toUnit = ''">
          <xsl:apply-templates select="." mode="getKUnit"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$toUnit"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:choose>
      <xsl:when test="$newUnit = 'K'">
        <xsl:value-of select="concat(format-number(. div 1000, '##,###,###0.00'),'KB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'M'">
        <xsl:value-of select="concat(format-number(. div (1000*1000), '##,###,###0.00'),'KB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'G'">
        <xsl:value-of select="concat(format-number(. div (1000*1000*1000), '##,###,##0.00'),'GB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'T'">
        <xsl:value-of select="concat(format-number(. div (1000*1000*1000*1000), '##,###,##0.00'),'TB')"/>
      </xsl:when>
      <xsl:when test="$newUnit = 'P'">
        <xsl:value-of select="concat(format-number(. div (1000*1000*1000*1000*1000), '##,###,##0.00'),'PB')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="format-number(., '##,###,##0.00')"/>
      </xsl:otherwise>
    </xsl:choose>

  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME: getKUnit                                               -->
  <!-- DESCRIPTION: determine unit to display based on input n      -->
  <!-- ============================================================ -->
  <xsl:template match="@*" mode="getKUnit">
    <xsl:choose>
      <xsl:when test=". &lt; 1000">
        <xsl:value-of select="'K'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1000*1000">
        <xsl:value-of select="'M'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1000*1000*1000">
        <xsl:value-of select="'G'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1000*1000*1000*1000">
        <xsl:value-of select="'T'"/>
      </xsl:when>
      <xsl:when test=". &lt; 1000*1000*1000*1000*1000">
        <xsl:value-of select="'P'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="''"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- NAME: allToTotal                                             -->
  <!-- DESCRIPTION: checks if name is All rename to Total           -->
  <!-- ============================================================ -->
  <xsl:template match="@name" mode="allToTotal">
    <xsl:choose>
      <xsl:when test=". = $NAME_ALL">
        <xsl:value-of select="'Total'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="."/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- threshold -->
  <xsl:template name="getThreshold">
    <xsl:param name="diskLevel" select="'N'"/>
    
    <xsl:choose>
      <xsl:when test="$diskLevel = 'Y'">
        <xsl:value-of select="$diskThreshold"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$cellThreshold"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================== -->
  <!-- TEMPLATE: showRow                                              -->
  <!-- DESCRIPTION: Determines if a row should be shown, checks       -->
  <!--  . cellName = 'All' is always shown                            -->
  <!--  . overall activity:                                           -->
  <!--    if hard disk and not enough disk activity then don't show   -->
  <!--    if flash disk and not enough flash activity then don't show -->
  <!--  . if buckets != 0 exist, show the row                         -->
  <!-- RETURNS:                                                       -->
  <!-- 1 for 'All', 0 for idle system, or # of non-0 buckets          -->
  <!-- ============================================================== -->
  <xsl:template match="cell|disk" mode="showRow">
    <xsl:param name="diskType"/>
    <xsl:variable name="diskLevel">
      <xsl:choose>
        <xsl:when test="local-name() = 'disk'">
          <xsl:value-of select="'Y'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'N'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="./@name=$NAME_ALL">
        <xsl:value-of select="number(1)"/>
      </xsl:when>
      <xsl:when test="substring($diskType,1,1) = 'H' and $showDiskOutliers = 0">
        <xsl:value-of select="number(0)"/>
      </xsl:when>
      <xsl:when test="substring($diskType,1,1) = 'F' and $showFlashOutliers = 0">
        <xsl:value-of select="number(0)"/>
      </xsl:when>
      <xsl:when test="substring($diskType,1,1) = 'C' and $showCpuOutliers = 0">
        <xsl:value-of select="number(0)"/>
      </xsl:when>
      <xsl:when test="$diskLevel = 'Y'">
        <xsl:value-of select="count(./stat[(@bkt &gt;= $diskThreshold or @bkt &lt;= 0-$diskThreshold) and not(@mgn)])"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="count(./stat[(@bkt &gt;= $cellThreshold or @bkt &lt;= 0-$cellThreshold) and not(@mgn)])"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE: show row in outlier detail section                 -->
  <!-- this is different from above in that we do not check  bkts   -->
  <!-- returns 0 for idle, 1 for showing the row                    -->
  <!-- ============================================================ -->
  <xsl:template match="cell|disk" mode="showRowOutlierDetail">
    <xsl:param name="diskType"/>
    <xsl:variable name="diskLevel">
      <xsl:choose>
        <xsl:when test="local-name() = 'disk'">
          <xsl:value-of select="'Y'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'N'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:choose>
      <xsl:when test="substring($diskType,1,1) = 'H' and $showDiskOutliers = 0">
        <xsl:value-of select="number(0)"/>
      </xsl:when>
      <xsl:when test="substring($diskType,1,1) = 'F' and $showFlashOutliers = 0">
        <xsl:value-of select="number(0)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="number(1)"/>
      </xsl:otherwise>
    </xsl:choose>

  </xsl:template>

  <!-- =========================================================== -->
  <!-- TEMPLATE for creating link from outlier to top              -->
  <!-- This has to check if it is in top based on rank             -->
  <!-- =========================================================== -->
  <xsl:template match="cell" mode="createLink">
    <xsl:param name="linkDestination"/>

    <xsl:choose>
      <xsl:when test="./@rank &lt;= $topN">
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="./@name"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME: getStatUnit                                            -->
  <!-- DESCRIPTION: for a given stat name, determine unit format    -->
  <!-- ============================================================ -->
  <xsl:template match="stat/@name" mode="getStatUnit">
    <xsl:choose>
      <xsl:when test=". = 'iops' or . = 'iorq' 
                or . = 'srrq' or . = 'swrq'
                or . = 'lrrq' or . = 'lwrq'">
        <xsl:value-of select="$UNIT_NONE"/>
      </xsl:when>
      <!-- eventually support bytes -->
      <xsl:when test=". = 'mbps' or . = 'iomb' 
                or . = 'srmb' or . = 'swmb'
                or . = 'lrmb' or . = 'lwmb'">

        <xsl:value-of select="$UNIT_NONE"/>
      </xsl:when>
      <xsl:when test=". = 'st' or . = 'wt'
                   or . = 'ap'
                   or . = 'sr' or . = 'sw'
                   or . = 'lr' or . = 'lw'">
        <xsl:value-of select="$UNIT_SEC"/>
      </xsl:when>
      <!-- default covers util, usr, sys, wio -->
      <xsl:otherwise>
        <xsl:value-of select="$UNIT_NONE"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- for a given number n, and based on stat unit type, determine -->
  <!-- actual unit to use, e.g. for seconds, - s, ms, us, ns        -->
  <!-- ============================================================ -->
  <xsl:template match="stat/@*" mode="getUnit">
    <xsl:param name="statUnit">
      <xsl:choose>
        <xsl:when test="$statUnit = $UNIT_SEC">
          <xsl:apply-templates select="." mode="getMsUnit"/>
        </xsl:when>
        <xsl:when test="$statUnit = $UNIT_BYTE">
          <xsl:call-template name="getMBUnit">
            <xsl:with-param name="n" select="."/>
          </xsl:call-template>
        </xsl:when>
        <xsl:when test="$statUnit = $UNIT_NUMK">
          <xsl:call-template name="getKUnit">
            <xsl:with-param name="n" select="."/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="''"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:param>
  </xsl:template>

  <!-- =========================================================== -->
  <!-- TEMPLATE for displaying stats for 'All' in Outlier sections -->
  <!-- This includes displaying mean/stddev/lo/hi                  -->
  <!-- color codes for max only (since by definition 'All' is not  -->
  <!-- an outlier; optionally displays units, currently used for   -->
  <!-- latency sections                                            -->
  <!-- ============================================================ -->
  <xsl:template match="stat" mode="allMean">
    <xsl:param name="statUnit" select="$UNIT_NONE"/>
    <xsl:param name="toUnit" select="$UNIT_NONE"/>
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="statName" select="./@name"/>
    <!-- note for outlier summary we check if mean is over max -->
    <!-- as the is_max flag is only for the value of the individual outlier -->
    <xsl:variable name="isMeanMax">
      <xsl:value-of select="(name(../../..) = 'outlier_summary' 
                            and ./@mean &gt; //capacity/caps/cap/disk[@disk_type=$diskType]/*[name() = $statName])"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="(./@is_max and ./@is_max = 'Y' 
                      and name(../../..) != 'outlier_summary')
                      or $isMeanMax = 'true' or $isMeanMax = 1">
        <td class="examax">*</td>
        <td align="right" class="examax">
          <xsl:apply-templates select="./@mean" mode="formatValue">
            <xsl:with-param name="statUnit" select="$statUnit"/>
            <xsl:with-param name="toUnit" select="$toUnit"/>
          </xsl:apply-templates>
        </td>
      </xsl:when>
      <xsl:otherwise>
        <td align="right" colspan="2">
          <xsl:apply-templates select="./@mean" mode="formatValue">
            <xsl:with-param name="statUnit" select="$statUnit"/>
            <xsl:with-param name="toUnit" select="$toUnit"/>
          </xsl:apply-templates>
        </td>
      </xsl:otherwise>
    </xsl:choose>
    <td align="right">
      <xsl:apply-templates select="./@stddev" mode="formatValue">
        <xsl:with-param name="statUnit" select="$statUnit"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
    </td>
    <td align="right" class="exabr" nowrap="true">
      <xsl:apply-templates select="./@lo" mode="formatValue"> 
        <xsl:with-param name="statUnit" select="$statUnit"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      - 
      <xsl:apply-templates select="./@hi" mode="formatValue">
        <xsl:with-param name="statUnit" select="$statUnit"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
    </td>
  </xsl:template>

  <!-- =========================================================== -->
  <!-- TEMPLATE for displaying individual stats values             -->
  <!-- sections                                                    -->
  <!-- This displays an individual column for the stat (cell/disk) -->
  <!-- and based on the value, it will color-code, if              -->
  <!--  . exceeds max capacity (is_max='Y')                        -->
  <!--  . outlier low range                                        -->
  <!--  . outlier high range                                       -->
  <!--  checks if we need to suppress outliers before marking them -->
  <!-- ============================================================ -->
  <xsl:template match="stat/@*" mode="outlier">
    <xsl:param name="linkDestination" select="$EMPTY_STRING"/>
    <xsl:param name="statUnit" select="$UNIT_NONE"/>
    <xsl:param name="toUnit" select="$EMPTY_STRING"/>
    <xsl:param name="class" select="$EMPTY_STRING"/>
    <xsl:param name="withIndicator" select="'Y'"/>

    <xsl:variable name="diskLevel">
      <xsl:choose>
        <!-- regular stat is just cell/disk to stat -->
        <!-- for outlier summary, we go back 3 levels -->
        <xsl:when test="name(../..) = 'disk' or name(../../..) = 'disk'">
          <xsl:value-of select="'Y'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'N'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="diskType">
      <xsl:choose>
        <xsl:when test="name(../../../..) = 'outlier_summary'">
          <xsl:value-of select="../../@disk_type"/>
        </xsl:when>
        <!-- cpu doesn't have a disk type -->
        <xsl:when test="../../../../@type ='cpu'">
          <xsl:value-of select="'C'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="../../../@disk_type"/>          
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- determine if we need to show outliers mainly for 'top' section -->
    <!-- if insufficient activity, we suppress them                     -->
    <!-- for outlier section, the showRow already handles this          -->
    <xsl:variable name="markOutlier">
      <xsl:choose>
        <xsl:when test="(substring($diskType,1,1) = 'H' and $showDiskOutliers = 0) or
                        (substring($diskType,1,1) = 'F' and $showFlashOutliers = 0) or
                        (substring($diskType,1,1) = 'C' and $showCpuOutliers = 0)">
          <xsl:value-of select="'N'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'Y'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
      
    <!-- determine threshold -->
    <xsl:variable name="threshold">
      <xsl:choose>
        <xsl:when test="$diskLevel = 'Y'">
          <xsl:value-of select="$diskThreshold"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$cellThreshold"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- create marker for max/hi/lo if required -->
    <xsl:if test="$markOutlier = 'Y' and $withIndicator = 'Y'">
      <xsl:choose>
        <xsl:when test="../@is_max and ../@is_max = 'Y'">
          <td class="examax">*</td>
        </xsl:when>
        <xsl:when test="../@bkt &lt;= 0-$threshold and not(../@mgn)">
          <td class="exaoutl">v</td>
        </xsl:when>
        <xsl:when test="../@bkt &gt;= $threshold and not(../@mgn)">
          <td class="exaouth">^</td>
        </xsl:when>
      </xsl:choose>
    </xsl:if>

    <!-- display value with optional link to outlier details -->
    <td align="right">
      <xsl:choose>
        <xsl:when test="$markOutlier = 'Y'
                       and ../@is_max and ../@is_max = 'Y'">
          <xsl:attribute name="class">
            <xsl:value-of select="'examax'"/>                      
            <xsl:if test="$class != $EMPTY_STRING">
              <xsl:value-of select="concat(' ',$class)"/>
            </xsl:if>
          </xsl:attribute>
          <!-- if we're suppressing indicators for outlier summary -->
          <!-- make sure we span the column                        -->
          <xsl:if test="$withIndicator = 'N'">
            <xsl:attribute name="colspan">
              <xsl:value-of select="2"/>
            </xsl:attribute>
          </xsl:if>
        </xsl:when>
        <xsl:when test="$markOutlier = 'Y' and
                        ../@bkt &lt;= 0-$threshold and not(../@mgn)">
          <xsl:attribute name="class">
            <xsl:value-of select="'exaoutl'"/>
            <xsl:if test="$class != $EMPTY_STRING">
              <xsl:value-of select="concat(' ',$class)"/>
            </xsl:if>
          </xsl:attribute>
          <xsl:if test="$withIndicator = 'N'">
            <xsl:attribute name="colspan">
              <xsl:value-of select="2"/>
            </xsl:attribute>
          </xsl:if>
        </xsl:when>

        <xsl:when test="$markOutlier = 'Y' and
                        ../@bkt &gt;= $threshold and not(../@mgn)">
          <xsl:attribute name="class">
            <xsl:value-of select="'exaouth'"/>
            <xsl:if test="$class != $EMPTY_STRING">
              <xsl:value-of select="concat(' ',$class)"/>
            </xsl:if>
          </xsl:attribute>
          <xsl:if test="$withIndicator = 'N'">
            <xsl:attribute name="colspan">
              <xsl:value-of select="2"/>
            </xsl:attribute>
          </xsl:if>

        </xsl:when>
        <xsl:otherwise>
          <xsl:attribute name="colspan">
            <xsl:value-of select="2"/>
          </xsl:attribute>
          <xsl:if test="$class != $EMPTY_STRING">
            <xsl:attribute name="class">
              <xsl:value-of select="$class"/>
            </xsl:attribute>
          </xsl:if>
        </xsl:otherwise>
      </xsl:choose>

      <!-- link should only be displayed if this is an outlier 
           and link destination exists -->
      <xsl:choose>
        <xsl:when test="$markOutlier = 'Y'
                        and $linkDestination != $EMPTY_STRING
                        and ((../@bkt &lt;= 0-$threshold and not(../@mgn)) 
                         or (../@bkt &gt;= $threshold and not(../@mgn)))">
          <a>
            <xsl:if test="../@is_max and ../@is_max = 'Y'">
              <xsl:attribute name="style">
                <xsl:value-of select="'color:White'"/>
              </xsl:attribute>
            </xsl:if>
            <xsl:attribute name="href">
              <xsl:value-of select="$linkDestination"/>
            </xsl:attribute>
            <xsl:apply-templates select="." mode="formatValue">
              <xsl:with-param name="statUnit" select="$statUnit"/>
              <xsl:with-param name="toUnit" select="$toUnit"/>
            </xsl:apply-templates>
          </a>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="." mode="formatValue">
            <xsl:with-param name="statUnit" select="$statUnit"/>
            <xsl:with-param name="toUnit" select="$toUnit"/>
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- TEMPLATE for displaying Totals                             -->

  <!-- display total in a column, and average in a third column   -->
  <!-- used for 'All' node in outlier cells                       -->
  <xsl:template match="stat/@tot" mode="allTotal">
    <td align="right"><xsl:apply-templates select="." mode="number"/></td>
    <td></td>
    <xsl:apply-templates select="." mode="getAvg"/>
  </xsl:template>

  <!-- retrieves average value for the cell in a table column     -->
  <xsl:template match="stat/@tot" mode="getAvg">
    <xsl:param name="class" select="'exabr'"/>
    <xsl:variable name="numCells">
      <xsl:value-of select="../../../@num_cells"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="../@is_max and ../@is_max = 'Y'">
        <td class="examax">*</td>
        <td align="right">
          <xsl:attribute name="class">
            <xsl:value-of select="concat($class,' examax')"/>
          </xsl:attribute>
          <xsl:value-of select="format-number(number(. div $numCells),'##,###,##0.00')"/>
        </td>
      </xsl:when>
      <xsl:otherwise>
        <td align="right" colspan="2">
          <xsl:if test="$class != ''">
            <xsl:attribute name="class">
              <xsl:value-of select="$class"/>
            </xsl:attribute>
          </xsl:if>
          <xsl:value-of select="format-number(. div $numCells,'##,###,##0.00')"/>
        </td>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- retrieves average value of the cell -->
  <xsl:template match="stat/@tot" mode="avgValue">
    <xsl:variable name="numCells">
      <xsl:value-of select="../../../@num_cells"/>
    </xsl:variable>
    <xsl:value-of select="format-number(. div $numCells,'##,###,##0.00')"/>
  </xsl:template>

  <!-- retrieves mean value with formatting -->
  <xsl:template match="stat/@mean" mode="meanValue">
    <xsl:param name="statUnit" select="$UNIT_NONE"/>
    <xsl:param name="toUnit" select="$UNIT_NONE"/>
    <xsl:apply-templates select="." mode="formatValue">
      <xsl:with-param name="statUnit" select="$statUnit"/>
      <xsl:with-param name="toUnit" select="$toUnit"/>
    </xsl:apply-templates>
  </xsl:template>
  
  <!-- ===================================================== -->
  <!-- TEMPLATE for displaying outlier message               -->
  <!-- for cell server, additional line to indicate idle     -->
  <!-- cells are determined by the corresponding stat        -->
  <!-- ===================================================== -->
  <xsl:template name="outlierMessage">
    <xsl:param name="entityType" select="cells"/>
    <xsl:param name="showColoringMessage" select="'Y'"/>
    <xsl:param name="showMaxCapacityMessage" select="'N'"/>
    <xsl:param name="cellServer" select="'N'"/>
    <xsl:variable name="diskLevel">
      <xsl:choose>
        <xsl:when test="$entityType = 'cells'">
          <xsl:value-of select="'N'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'Y'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="threshold">
      <xsl:call-template name="getThreshold">
        <xsl:with-param name="diskLevel" select="$diskLevel"/>
      </xsl:call-template>
    </xsl:variable>
    <li class="exa">Outliers are <xsl:value-of select="$entityType"/> whose average performance is outside the normal range, where normal range is -/+ <xsl:value-of select="$threshold"/> standard deviation</li>
    <li class="exa">Outlier <xsl:value-of select="$entityType"/> must have a mininum of <xsl:value-of select="$thresholdIdleIOPs"/> IOPs.  Idle <xsl:value-of select="$entityType"/> are not considered for outlier analysis.</li>
    <xsl:if test="$cellServer = 'Y'">
      <li class="exa">Outliers for small reads, small writes, large read, large writes, must have a minimum of <xsl:value-of select="$thresholdIdleIOPs"/> requests for the corresponding small read, small write, large read, large write statistic.</li>
    </xsl:if>
    <li class="exa">Outliers for hard disks are displayed when Hard Disk IOPs exceeds <xsl:value-of select="$thresholdDiskIOPs"/>
        (<xsl:value-of select="$pctThreshold"/>% of maximum capacity of <xsl:value-of select="$maxDiskIOPs"/>)</li>
    <xsl:if test="$showDiskOutliers = 0">
      <li class="exa">Outliers for hard disks will not be displayed.  There are only <xsl:value-of select="$currDiskIOPs"/> hard disk IOPs</li>
    </xsl:if>
    <li class="exa">Outliers for flash disks are displayed when Flash Disk IOPs exceeds <xsl:value-of select="$thresholdFlashIOPs"/>
        (<xsl:value-of select="$pctThreshold"/>% of maximum capacity of <xsl:value-of select="$maxFlashIOPs"/>)</li> 
    <xsl:if test="$showFlashOutliers = 0">
      <li class="exa">Outliers for flash disks will not be displayed.  There are only <xsl:value-of select="$currFlashIOPs"/> flash IOPs</li>
    </xsl:if>
    <xsl:if test="($showDiskOutliers = 1 or $showFlashOutliers = 1) and $showColoringMessage='Y'">
       <li class="exa">A 'v' and a dark yellow background indicates an outlier value below the low range</li>
       <li class="exa">A '^' and a light red background indicates an outlier value above the high range</li>
    </xsl:if>
     <xsl:if test="$showMaxCapacityMessage = 'Y'">
       <li class="exa">A '*' and a dark red background indicates over maximum capacity</li>         
     </xsl:if>
 
  </xsl:template>

  <!-- ======================================================= -->
  <!--  TEMPLATE for showing coloring message for top sections -->
  <!-- ======================================================= -->
  <xsl:template name="topMessageForColor">
    <xsl:param name="showMaxCapacityMessage" select="'N'"/>
    <xsl:if test="$showDiskOutliers = 1 or $showFlashOutliers = 1">
       <li class="exa">A 'v' and a dark yellow background indicates an outlier value below the low range</li>
       <li class="exa">A '^' and a light red background indicates an outlier value above the high range</li>
    </xsl:if>
     <xsl:if test="$showMaxCapacityMessage = 'Y'">
       <li class="exa">A '*' and a dark red background indicates over maximum capacity</li>         
     </xsl:if>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying Resource Statistics TOC              -->
  <!-- ============================================================ -->
  <xsl:template name="resourceStatisticsToc">
    <xsl:param name="setPadding" select="'N'"/>
    <xsl:param name="withDetail" select="'N'"/>
    <ul class="exa">
      <xsl:if test="$setPadding = 'Y'">
        <xsl:attribute name="style">
          <xsl:value-of select="'padding-left:20px'"/>
        </xsl:attribute>
      </xsl:if>
      <li><a class="exa" href="#CELL_OUTLIER_SUMMARY"><xsl:value-of select="$titleExaOutlierSumm"/></a></li>
      <li><a class="exa" href="#CELL_OS_OUTLIERS"><xsl:value-of select="$titleExaOsOutlierStat"/></a></li>
      <xsl:if test="$withDetail = 'Y'">
      <ul class="exa" style="padding-left:20px">
        <li><a class="exa" href="#OS_IO_CELL">Exadata OS IO Statistics</a></li>
        <li><a class="exa" href="#OS_LATENCY_CELL">Exadata OS IO Latency</a></li>
        <li class="exa"><a class="exa" href="#OS_CPU_CELL">Exadata OS CPU Statistics</a></li>
      </ul>
      </xsl:if>
      <li><a class="exa" href="#CELL_SERVER_OUTLIERS"><xsl:value-of select="$titleExaCellSrvOutlierStat"/></a></li>
      <xsl:if test="$withDetail = 'Y'">
      <ul class="exa" style="padding-left:20px">
        <li><a class="exa" href="#CELLSRV_IOPS_CELL">Cell Server IOPS Statistics</a></li>
        <li><a class="exa" href="#CELLSRV_MBPS_CELL">Cell Server IO MB/s Statistics</a></li>
        <li><a class="exa" href="#CELLSRV_LATENCY_CELL">Cell Server IO Latency Statistics</a></li>
      </ul>
      </xsl:if>
      <li><a class="exa" href="#CELL_OUTLIER_DETAILS"><xsl:value-of select="$titleExaOutlierDetails"/></a></li>
      <xsl:if test="$withDetail = 'Y'">
      <ul class="exa" style="padding-left:20px">
        <li><a class="exa" href="#CELL_OS_OUTLIER_DETAILS_CELL">Exadata OS Statistics Outlier Details</a></li>
          <li><a class="exa" href="#CELLSRV_OUTLIER_DETAILS_CELL">Exadata Cell Server Outlier Details</a></li>
      </ul>
      </xsl:if>
      <li><a class="exa" href="#CELL_OS_TOP"><xsl:value-of select="$titleExaOsTopStat"/></a></li>
      <xsl:if test="$withDetail = 'Y'">
      <ul class="exa" style="padding-left:20px">
        <li><a class="exa" href="#OS_IO_CELL_TOP">Exadata OS IO Statistcs</a></li>
        <li><a class="exa" href="#OS_LATENCY_CELL_TOP">Exadata OS IO Latency Statistics</a></li>
        <li><a class="exa" href="#OS_CPU_CELL_TOP">Exadata OS CPU Statistics</a></li>
      </ul>
      </xsl:if>
      <li><a class="exa" href="#CELL_SERVER_TOP"><xsl:value-of select="$titleExaCellSrvTopStat"/></a></li>
      <xsl:if test="$withDetail = 'Y'">
      <ul class="exa" style="padding-left:20px">

        <li><a class="exa" href="#CELLSRV_IOPS_CELL_TOP">Cell Server IOPS Statistics</a></li>
        <li><a class="exa" href="#CELLSRV_MBPS_CELL_TOP">Cell Server IO MB/s Statistics</a></li>
        <li><a class="exa" href="#CELLSRV_LATENCY_CELL_TOP">Cell Server IO Latency</a></li>
      </ul>
      </xsl:if>
    </ul>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying Smart I/O TOC                        -->
  <!-- ============================================================ -->
  <xsl:template name="smartIoToc">
    <xsl:param name="setPadding" select="'N'"/>
    <ul class="exa">
      <xsl:if test="$setPadding = 'Y'">
        <xsl:attribute name="style">
          <xsl:value-of select="'padding-left:20px'"/>
        </xsl:attribute>
      </xsl:if>
      <li><a class="exa" href="#CELL_SMART_IO">Smart IO</a></li>
      <xsl:if test="count(//cellstats[@type='passthru']) &gt; 0">
         <li><a class="exa" href="#CELL_PASSTHRU">Passthru Reasons</a></li>
      </xsl:if>
      <xsl:if test="//cellstats[@type='offload_write']">
        <li><a class="exa" href="#CELL_OFFLOAD_WRITES">Write Offload</a></li>
      </xsl:if>
      <li><a class="exa" href="#CELL_FLASH_LOG_MAIN">Flash Log</a></li>
      <li><a class="exa" href="#CELL_FLASH_CACHE">Flash Cache</a></li>
      <xsl:if test="$hasRamCache = 'Y'">
        <li><a class="exa" href="#CELL_RAM_CACHE">Memory Cache</a></li>
      </xsl:if>
    </ul>
    
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying IO Reason TOC                        -->
  <!-- ============================================================ -->
  <xsl:template name="ioReasonToc">
    <xsl:param name="setPadding" select="'N'"/>
    <ul class="exa">
      <xsl:if test="$setPadding = 'Y'">
        <xsl:attribute name="style">
          <xsl:value-of select="'padding-left:20px'"/>
        </xsl:attribute>
      </xsl:if>
      <li><a class="exa" href="#CELL_IOREASON_REQ">Top IO Reasons by Requests</a></li>
      <li><a class="exa" href="#CELL_IOREASON_MB">Top IO Reasons by MB</a></li>
    </ul>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying Top DB Consumers TOC                 -->
  <!-- ============================================================ -->
  <xsl:template name="topDbConsumerToc">
    <xsl:param name="setPadding" select="'N'"/>
    <ul class="exa">
      <xsl:if test="$setPadding = 'Y'">
        <xsl:attribute name="style">
          <xsl:value-of select="'padding-left:20px'"/>
        </xsl:attribute>
      </xsl:if>
      <li><a class="exa" href="#CELL_TOPDB_REQ">Top Databases by Requests</a></li>
      <li><a class="exa" href="#CELL_TOPDB_REQ_DETAIL">Top Databases by Requests - Details</a></li>
      <li><a class="exa" href="#CELL_TOPDB_MB">Top Databases by Throughput</a></li>
      <li><a class="exa" href="#CELL_TOPDB_REQ_CELL">Top Databases by Requests per Cell</a></li>
      <li><a class="exa" href="#CELL_TOPDB_REQ_CELL_DETAIL">Top Databases by Requests per Cell - Details</a></li>
      <li><a class="exa" href="#CELL_TOPDB_MB_CELL">Top Databases by Throughput per Cell</a></li>
    </ul>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying IO Latency Capping TOC               -->
  <!-- ============================================================ -->
  <xsl:template name="ioCappingToc">
    <xsl:param name="setPadding" select="'N'"/>
    <ul class="exa">
      <xsl:if test="$setPadding = 'Y'">
        <xsl:attribute name="style">
          <xsl:value-of select="'padding-left:20px'"/>
        </xsl:attribute>
      </xsl:if>
      <li><a class="exa" href="#CELL_IO_CAPPING_ASM">Cancelled IOs - Client</a></li>
      <li><a class="exa" href="#CELL_IO_CAPPING_EXA">Cancelled IOs - Cells</a></li>
    </ul>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- NAME:  join                                                  -->
  <!-- DESCRIPTION: converts a list of child nodes into a string    -->
  <!-- PARAMETERS:                                                  -->
  <!--   list - list of XML nodes                                   -->
  <!--   separator - separator to use for the generated string      -->
  <!--               dfeault is ','                                 -->
  <!-- ============================================================ -->
  <xsl:template name="join">
    <xsl:param name="list"/>
    <xsl:param name="separator" select="', '"/>

    <xsl:for-each select="$list">
      <xsl:value-of select="."/>
      <xsl:if test="position() != last()">
        <xsl:value-of select="$separator"/>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>




  <!-- ============================================================================= -->
  <!--  main html output starts here                                                 -->
  <!-- ============================================================================= -->
  <xsl:template match="/">
    <html>
      <xsl:choose>
        <!-- high level section links in AWR report            -->
        <!-- we need to use exa styling to prevent extra space -->
        <xsl:when test="/report/toc">
          <h2 class="exa">Exadata Configuration and Statistics</h2>
          <ul class="exa">
            <li><a class="exa" href="#CELL_REPT">Exadata Report Summary</a></li>
            <li><a class="exa" href="#CELL_CONFIGURATION">Exadata Server Configuration</a></li>
            <li><a class="exa" href="#CELL_HEALTH">Exadata Server Health Report</a></li>
            <li><a class="exa" href="#CELL_STATISTICS">Exadata Statistics</a></li>

          </ul>
        </xsl:when>

        <!-- actual report contents -->
        <xsl:otherwise>
          <head>
            <title>Exadata Configuration and Statistics</title>
            <style type="text/css">
             body.exa {font:bold 10pt Arial,Helvetica,Geneva,sans-serif;color:black; background:White;}
             table.exa, input.exa, select.exa, textarea.exa, li.exa
             {font:8pt Arial,Helvetica,Geneva,sans-serif}
             th.exa {font:bold 8pt Arial,Helvetica,Geneva,sans-serif;
                 color:White;
                 background:#0066CC;
                 padding-left:4px;
                 padding-right:4px;
                 padding-bottom:2px;
                 white-space:nowrap}
             tr.exa:nth-child(even) { background-color:White }
             tr.exa:nth-child(odd)  { background-color:#FFFFCC }
             h1.exa {font:bold 20pt Arial,Helvetica,Geneva,sans-serif;
                     color:#336699;background-color:White;
                     border-bottom:1px solid #cccc99;
                     margin-top:0pt; margin-bottom:0pt;
                     padding:0px 0px 0px 0px;}
             h2.exa {font:bold 18pt Arial,Helvetica,Geneva,sans-serif;
                     color:#336699;background-color:White;
                     margin-top:4pt; margin-bottom:0pt;}
             h3.exa {font:bold 16pt Arial,Helvetica,Geneva,sans-serif;
                 color:#336699;background-color:White;
                 margin-top:4pt; margin-bottom:0pt;}
             h4.exa {font:bold 14pt Arial,Helvetica,Geneva,sans-serif;
                 color:#336699;background-color:White;
                 margin-top:4pt; margin-bottom:0pt;}
             tr.exat td { border-top: thin solid black }
             td.exaouth { background-color:#FFCCCC; empty-cells:show}
             td.exaouthbr { background-color:#FFCCCC; border-right: thin solid black; }
             td.exaouthbt { background-color:#FFCCCC; border-top: thin solid black; }
             td.exaouthbrt { background-color:#FFCCCC; 
                             border-right: thin solid black;
                             border-top: thin solid black }
             td.exaoutl { background-color:#FBE180 }
             td.exaoutlbr { background-color:#FBE180; border-right: thin solid black; }
             td.exaoutlbt { background-color:#FBE180; border-top: thin solid black; }
             td.exaoutlbrt { background-color:#FBE180; border-right: thin solid black; 
                             border-top: thin solid black }
             td.examax { font:bold 8pt Arial,Helvetica,Geneva,sans-serif;
               background-color:#800000; color:White;}
             td.examaxbr {font:bold 8pt Arial,Helvetica,Geneva,sans-serif;
               background-color:#800000; color:White; border-right: thin solid black; }
             td.examaxbrt { font:bold 8pt Arial,Helvetica,Geneva,sans-serif;
               background-color:#800000; color:White;
               border-right: thin solid black; border-top: thin solid black }
             td.examaxbt { font:bold 8pt Arial,Helvetica,Geneva,sans-serif;
               background-color:#800000; color:White; 
               border-top: thin solid black }
             td.exabr {border-right: thin solid black; empty-cells:show; }
             td.exabt {border-top: thin solid black; empty-cells:show; }
             td.exabrt {border-top: thin solid black; border-right: thin solid black;
                        empty-cells:show; }
             td.exawarn { font: bold 8pt Arial,Helvetica,Geneva,sans-serif;
                          background-color:#B22222; color:White }
             li.exab {font:bold 8pt Arial,Helvetica,sans-serif;color:#663300;
                    vertical-align:top;margin-top:0pt; margin-bottom:0pt;}
             a.exa {font:bold 8pt Arial,Helvetica,sans-serif;color:#663300;
                    vertical-align:top;margin-top:0pt; margin-bottom:0pt;}
             ul.exa { list-style-position:outside }
             ul.exa li { position:relative; 
                         font:bold 8pt Arial,Helvetica,Geneva,sans-serif}
             ul.exa li a { position:absolute; }
            </style>
            <!-- bug20313052: last 3 ul,li,a is for enuring proper alignment -->
          </head>

          <body class="exa" bgcolor="#FFFFFF">
          <!-- display contents if we're not asking for toc -->
          <!-- configuration sections -->
          <a name="CELL_CONFIGURATION"/>
          <h2 class="exa">Exadata Server Configuration</h2>
          <ul class="exa">
            <li><a class="exa" href="#CELL_STORAGE_SERVER_MODEL">Exadata Storage Server Model</a></li>
            <li><a class="exa" href="#CELL_STORAGE_SERVER_VERSION">Exadata Storage Server Version</a></li>
            <li><a class="exa" href="#CELL_STORAGE_INFORMATION">Exadata Storage Information</a></li>
            <li><a class="exa" href="#CELL_GRIDDISK">Exadata Griddisks</a></li>
            <li><a class="exa" href="#CELL_CELLDISK">Exadata Celldisks</a></li>
            <li><a class="exa" href="#ASM_DISKGROUP">ASM Diskgroups</a></li>
          </ul>

          <xsl:apply-templates select="//configs[@type='makemodel']"/>
          <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
          <xsl:apply-templates select="//configs[@type='version']"/>
          <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
          <xsl:apply-templates select="//configs[@type='storage']"/>
          <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
          <xsl:apply-templates select="//configs[@type='griddisk']"/>
          <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
          <xsl:apply-templates select="//configs[@type='celldisk']"/>
          <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
          <xsl:apply-templates select="//configs[@type='asm_diskgroup']"/>
          <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>

          <!-- health sections -->
          <a name="CELL_HEALTH"/>
          <h2 class="exa">Exadata Server Health Report</h2>
          <ul class="exa">
            <li><a class="exa" href="#CELL_ALERTS_SUMMARY">Exadata Alerts Summary</a></li>
            <li><a class="exa" href="#CELL_ALERTS_DETAIL">Exadata Alerts Detail</a></li>
            <li><a class="exa" href="#CELL_OFFLINE_DISKS">Exadata Non-Online Disks</a></li>
          </ul>
          <br/><a class="exa" href="#top">Back to Top</a>
          <xsl:apply-templates select="//cellstats[@type='alerts']"/>
          <br/><a class="exa" href="#CELL_HEALTH">Back to Exadata Server Health Report</a>
          <xsl:apply-templates select="//cellstats[@type='alerts']/cells"/>
          <!-- display the section even if we have no alerts -->
          <xsl:if test="not(//cellstats[@type='alerts']/cells)">
            <a name="CELL_ALERT_DETAIL"/>
            <h3 class="exa">Exadata Alert Details</h3>
            <p>No open alerts.</p>
          </xsl:if>
          <br/><a class="exa" href="#CELL_HEALTH">Back to Exadata Server Health Report</a>
          <xsl:apply-templates select="//cellstats[@type='offline_disks']"/>
          <br/><a class="exa" href="#CELL_HEALTH">Back to Exadata Server Health Report</a>
            
          <!-- statistics section -->
          <a name="CELL_STATISTICS"/>
          <h2 class="exa">Exadata Statistics</h2>
          <ul class="exa">
            <li><a class="exa" href="#CELL_FLASH_CACHE_SUMMARY">Performance Summary</a></li>
            <li><a class="exa" href="#CELL_RESOURCE_STATISTICS"><xsl:value-of select="$titleExaResourceStat"/></a></li>
            <xsl:if test="$minReportIntervalMsg = 'N'">
              <xsl:call-template name="resourceStatisticsToc">
                <xsl:with-param name="setPadding" select="'Y'"/>
                <xsl:with-param name="withDetail"  select="'N'"/>
              </xsl:call-template>
            </xsl:if>
            <li><a class="exa" href="#CELL_SMART_STATISTICS">Exadata Smart Statistics</a></li>
            <xsl:call-template name="smartIoToc">
              <xsl:with-param name="setPadding" select="'Y'"/>
            </xsl:call-template>
            <li><a class="exa" href="#CELL_IOREASON">Exadata IO Reasons</a></li>
            <xsl:call-template name="ioReasonToc">
              <xsl:with-param name="setPadding" select="'Y'"/>
            </xsl:call-template>
            <li><a class="exa" href="#CELL_TOPDB">Exadata Top Database Consumers</a></li>
            <xsl:call-template name="topDbConsumerToc">
              <xsl:with-param name="setPadding" select="'Y'"/>
            </xsl:call-template>

            <li><a class="exa" href="#CELL_IO_CAPPING">Exadata IO Latency Capping</a></li>
            <xsl:call-template name="ioCappingToc">
              <xsl:with-param name="setPadding" select="'Y'"/>
            </xsl:call-template>
          </ul>
          <br/><a class="exa" href="#top">Back to Top</a>  
          <!-- performance summary -->
          <p><xsl:apply-templates select="//cellstats[@type='fc_summary']"/></p>
          <a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <br/><a class="exa" href="#top">Back to Top</a>  
          <!-- high level links to resource statistics sections -->
          <a name="CELL_RESOURCE_STATISTICS"/>
          <h3 class="exa"><xsl:value-of select="$titleExaResourceStat"/></h3>
          <!-- only display resource stats if minReportIntervalMsg is not set -->
          <xsl:choose>
            <xsl:when test="$minReportIntervalMsg = 'N'">
              <xsl:call-template name="resourceStatisticsToc">
                <xsl:with-param name="withDetail" select="'Y'"/>
              </xsl:call-template>
              <a class="exa" href="#top">Back to Top</a>        
              <!-- Outlier summary section -->
              <a name="CELL_OUTLIER_SUMMARY"/>
              <h3 class="exa"><xsl:value-of select="$titleExaOutlierSumm"/></h3>
              <ul class="exa">
                <li class="exab"><xsl:value-of select="$titleExaOutlierSumm"/></li>
                <ul class="exa" style="padding-left:20px">
                  <li><a class="exa" href="#OUTLIER_SUMMARY_CELL">Cell Level</a></li>
                  <li><a class="exa" href="#OUTLIER_SUMMARY_DISK">Disk Level</a></li>
                </ul>
              </ul>
  
              <p><xsl:apply-templates select="//outlier_summary[@type='cell']"/></p>
              <a class="exa" href="#CELL_OUTLIER_SUMMARY">Back to <xsl:value-of select="$titleExaOutlierSumm"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
  
              <p><xsl:apply-templates select="//outlier_summary[@type='disk']"/></p>
              <a class="exa" href="#CELL_OUTLIER_SUMMARY">Back to <xsl:value-of select="$titleExaOutlierSumm"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
  
  
              <!--  OS Outlier sections -->         
              <a name="CELL_OS_OUTLIERS"/>
              <h3 class="exa"><xsl:value-of select="$titleExaOsOutlierStat"/></h3>
              <ul class="exa">
                <li class="exab">Exadata OS IO Statistics</li>
                <ul class="exa" style="padding-left:20px">
                  <li><a class="exa" href="#OS_IO_CELL">Outlier Cells</a></li>
                  <li><a class="exa" href="#OS_IO_DISK">Outlier Disks</a></li>
                </ul>
                <li class="exab">Exadata OS IO Latency</li>
                <ul class="exa" style="padding-left:20px">
                  <li><a class="exa" href="#OS_LATENCY_CELL">Outlier Cells</a></li>
                  <li><a class="exa" href="#OS_LATENCY_DISK">Outlier Disks</a></li>
                </ul>
                <li class="exa"><a class="exa" href="#OS_CPU_CELL">Exadata OS CPU Statistics - Outlier Cells</a></li>
              </ul>
  
              <!-- OS IOPS sections -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_osstat']" mode="outlier"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_osstat']" mode="outlier"/></p>
              <a class="exa" href="#CELL_OS_OUTLIERS">Back to <xsl:value-of select="$titleExaOsOutlierStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
  
              <!-- OS IO Latency sections -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_latency']" mode="outlier"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_latency']" mode="outlier"/></p>
              <a class="exa" href="#CELL_OS_OUTLIERS">Back to <xsl:value-of select="$titleExaOsOutlierStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!-- OS CPU section -->
              <p><xsl:apply-templates select="//cellstats[@type='cpu']" mode="outlier"/></p>
              <a class="exa" href="#CELL_OS_OUTLIERS">Back to <xsl:value-of select="$titleExaOsOutlierStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!--  Cell Server Outlier sections -->
              <a name="CELL_SERVER_OUTLIERS"/>
              <h3 class="exa"><xsl:value-of select="$titleExaCellSrvOutlierStat"/></h3>
              <ul class="exa">
                <li class="exab">Cell Server IOPS Statistics</li>
                <ul class="exa" style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_IOPS_CELL">Outlier Cells</a></li>
                  <li><a class="exa" href="#CELLSRV_IOPS_DISK">Outlier Disks</a></li>
                </ul>
                <li class="exab">Cell Server IO MB/s Statistics</li>
                <ul class="exa" style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_MBPS_CELL">Outlier Cells</a></li>
                  <li><a class="exa" href="#CELLSRV_MBPS_DISK">Outlier Disks</a></li>
                </ul>
                <li class="exab">Cell Server IO Latency Statistics</li>
                <ul class="exa" style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_LATENCY_CELL">Outlier Cells</a></li>
                  <li><a class="exa" href="#CELLSRV_LATENCY_DISK">Outlier Disks</a></li>
                </ul>
              </ul>
              <br/><a class="exa" href="#top">Back to Top</a>    
              <!-- cell server IOPS outlier section -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_srviorq']" mode="outlier"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_srviorq']" mode="outlier"/></p>
              <a class="exa" href="#CELL_SERVER_OUTLIERS">Back to <xsl:value-of select="$titleExaCellSrvOutlierStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!-- cell server IOMB/s outlier section -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_srviomb']" mode="outlier"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_srviomb']" mode="outlier"/></p>
              <a class="exa" href="#CELL_SERVER_OUTLIERS">Back to <xsl:value-of select="$titleExaCellSrvOutlierStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!-- cell server IO Latency outlier section -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_srvlatency']" mode="outlier"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_srvlatency']" mode="outlier"/></p>
              <a class="exa" href="#CELL_SERVER_OUTLIERS">Back to <xsl:value-of select="$titleExaCellSrvOutlierStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!-- Outlier Details sections -->
              <a name="CELL_OUTLIER_DETAILS"/>
              <h3 class="exa"><xsl:value-of select="$titleExaOutlierDetails"/></h3>
              <ul class="exa">
                <li class="exab">Exadata OS Statistics Outlier Details</li>
                  <ul class="exa" style="padding-left:20px">       
                    <li><a class="exa" href="#CELL_OS_OUTLIER_DETAILS_CELL">Cell Outliers</a></li>
                    <li><a class="exa" href="#CELL_OS_OUTLIER_DETAILS_DISK">Disk Outliers</a></li>
                  </ul>
                <li class="exab">Exadata Cell Server Outlier Details</li>
                <ul class="exa"  style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_OUTLIER_DETAILS_CELL">Cell Outliers</a></li>
                  <li><a class="exa" href="#CELLSRV_OUTLIER_DETAILS_DISK">Disk Outliers</a></li>
                </ul>
              </ul>
    
              <p><xsl:apply-templates select="//outliers[@type='cell_osstat']"/></p>
              <p><xsl:apply-templates select="//outliers[@type='disk_osstat']"/></p>
              <a class="exa" href="#CELL_OUTLIER_DETAILS">Back to <xsl:value-of select="$titleExaOutlierDetails"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!-- Cell Server Outlier Details -->
              <p><xsl:apply-templates select="//outliers[@type='cell_srvstat']"/></p>
              <p><xsl:apply-templates select="//outliers[@type='disk_srvstat']"/></p>
              <a class="exa" href="#CELL_OUTLIER_DETAILS">Back to <xsl:value-of select="$titleExaOutlierDetails"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
    
              <!--  OS Top Sections -->
              <a name="CELL_OS_TOP"/>
              <h3 class="exa"><xsl:value-of select="$titleExaOsTopStat"/></h3>
              <ul class="exa" >
                <li class="exab">Exadata OS IO Statistcs</li>
                <ul class="exa"  style="padding-left:20px">
                  <li><a class="exa" href="#OS_IO_CELL_TOP">Top Cells</a> </li>
                  <li><a class="exa" href="#OS_IO_DISK_TOP">Top Disks</a></li>
                </ul>
                <li class="exab">Exadata OS IO Latency Statistics</li>
                <ul class="exa"  style="padding-left:20px">
                  <li><a class="exa" href="#OS_LATENCY_CELL_TOP">Top Cells</a></li>
                  <li><a class="exa" href="#OS_LATENCY_DISK_TOP">Top Disks</a></li>
                </ul>
                <li><a class="exa" href="#OS_CPU_CELL_TOP">Exadata OS CPU Statistics - Top Cells</a></li>
              </ul>
              <!--  we now call top by templates since they share the same XML as the outliers -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_osstat']" mode="top"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_osstat']" mode="top"/></p>
              <a class="exa" href="#CELL_OS_TOP">Back to <xsl:value-of select="$titleExaOsTopStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
              <p><xsl:apply-templates select="//cellstats[@type='cell_latency']" mode="top"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_latency']" mode="top"/></p>
              <a class="exa" href="#CELL_OS_TOP">Back to <xsl:value-of select="$titleExaOsTopStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
              <p><xsl:apply-templates select="//cellstats[@type='cpu']" mode="top"/></p>
              <a class="exa" href="#CELL_OS_TOP">Back to <xsl:value-of select="$titleExaOsTopStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
    
              <!--  Cell Server Top Sections -->
              <a name="CELL_SERVER_TOP"/>
              <h3 class="exa"><xsl:value-of select="$titleExaCellSrvTopStat"/></h3>
              <ul class="exa" >
                <li class="exab">Cell Server IOPS Statistics</li>
                <ul class="exa"  style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_IOPS_CELL_TOP">Top Cells</a></li>
                  <li><a class="exa" href="#CELLSRV_IOPS_DISK_TOP">Top Disks</a></li>
                </ul>
                <li class="exab">Cell Server IO MB/s Statistics</li>
                <ul class="exa"  style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_MBPS_CELL_TOP">Top Cells</a></li>
                  <li><a class="exa" href="#CELLSRV_MBPS_DISK_TOP">Top Disks</a></li>
                </ul>
                <li class="exab">Cell Server IO Latency</li>
                <ul class="exa"  style="padding-left:20px">
                  <li><a class="exa" href="#CELLSRV_LATENCY_CELL_TOP">Top Cells</a></li>
                  <li><a class="exa" href="#CELLSRV_LATENCY_DISK_TOP">Top Disks</a></li>
                </ul>
    
              </ul>
              <!--  call top by templates which share XML for outliers -->
              <p><xsl:apply-templates select="//cellstats[@type='cell_srviorq']" mode="top"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_srviorq']" mode="top"/></p>
              <a class="exa" href="#CELL_SERVER_TOP">Back to <xsl:value-of select="$titleExaCellSrvTopStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
              <p><xsl:apply-templates select="//cellstats[@type='cell_srviomb']" mode="top"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_srviomb']" mode="top"/></p>
              <a class="exa" href="#CELL_SERVER_TOP">Back to <xsl:value-of select="$titleExaCellSrvTopStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
              <p><xsl:apply-templates select="//cellstats[@type='cell_srvlatency']" mode="top"/></p>
              <p><xsl:apply-templates select="//cellstats[@type='disk_srvlatency']" mode="top"/></p>
              <a class="exa" href="#CELL_SERVER_TOP">Back to <xsl:value-of select="$titleExaCellSrvTopStat"/></a>
              <br/><a class="exa" href="#CELL_RESOURCE_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>
                
            </xsl:when>
            <xsl:otherwise>
              <p><xsl:value-of select="$minReportIntervalMsg"/></p>
            </xsl:otherwise>
          </xsl:choose>
  
          <a name="CELL_SMART_STATISTICS"/>
          <h3 class="exa">Exadata Smart Statistics</h3>
          <xsl:call-template name="smartIoToc"/>
          <br/><a class="exa" href="#top">Back to Top</a>

          <!--  smart io and flash log sections -->
          <p><xsl:apply-templates select="//cellstats[@type='smart_io']"/></p>
          <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>

          <!-- passthru only display entire section + header if XML exists -->
          <xsl:if test="count(//cellstats[@type='passthru']) &gt; 0">
            <p><xsl:apply-templates select="//cellstats[@type='passthru']"/></p>
            <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
            <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          </xsl:if>

          <xsl:if test="//cellstats[@type='offload_write']">
            <p><xsl:apply-templates select="//cellstats[@type='offload_write']"/></p>
            <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
            <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          </xsl:if>
  
          <!-- flash log main -->
          <a name="CELL_FLASH_LOG_MAIN"/>
          <h3 class="exa">Flash Log Statistics</h3>
          <ul class="exa">
            <li><a class="exa" href="#CELL_FLASH_LOG">Flash Log</a></li>
            <xsl:if test="//cellstats[@type='flskip']">
              <li><a class="exa" href="#CELL_FLASH_LOG_SKIP">Flash Log Skip Details</a></li>
            </xsl:if>
            <li><a class="exa" href="#CELL_FLASH_LOG_HISTOGRAM">Redo Write Histogram</a></li>
          </ul>

          <p><xsl:apply-templates select="//cellstats[@type='flash_log']"/></p>
          <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <!-- flash log skip details - only display if XML exists -->
          <xsl:if test="count(//cellstats[@type='flskip']) &gt; 0">
            <p><xsl:apply-templates select="//cellstats[@type='flskip']"/></p>
            <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
            <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          </xsl:if>

          <p><xsl:apply-templates select="//cellstats[@type='flhist']"/></p>
          <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <!--  flash cache -->
          <a name="CELL_FLASH_CACHE"/>
          <h3 class="exa">Flash Cache</h3>
          <xsl:if test="$hasEF = 'Y'">
            <p>This environment has EF cells - minimal or no Flash Cache activity expected</p>
          </xsl:if>
          <ul class="exa" >
            <xsl:if test="//config[@type='fc']">
              <li><a class="exa" href="#CELL_FLASH_CACHE_CONFIG">Flash Cache Configuration</a></li>
            </xsl:if>
            <li><a class="exa" href="#CELL_FLASH_CACHE_SPACE">Flash Cache Space Usage</a></li>
            <li><a class="exa" href="#CELL_FLASH_CACHE_UREADS">Flash Cache User Reads</a></li>
            <li><a class="exa" href="#CELL_FLASH_CACHE_UREADS_EFF">Flash Cache Efficiency</a></li>
            <li><a class="exa" href="#CELL_COLUMNAR_CACHE_UREADS_EFF">Columnar Cache Efficiency</a></li>
            <li><a class="exa" href="#CELL_FLASH_CACHE_UWRITES">Flash Cache User Writes</a></li>
            <xsl:if test="$hasFlashCacheLW = 'Y'">
            <li><a class="exa" href="#CELL_FLASH_CACHE_UWRITES_LW">Flash Cache User Writes - Large Writes</a></li>
            </xsl:if>
            <li><a class="exa" href="#CELL_FLASH_CACHE_IREADS">Flash Cache Internal Reads</a></li>
            <li><a class="exa" href="#CELL_FLASH_CACHE_IWRITES">Flash Cache Internal Writes</a></li>
            <li><a class="exa" href="#CELL_COLUMNAR_CACHE_IWRITES">Columnar Cache Population</a></li>
            <li><a class="exa" href="#CELL_COLUMNAR_CACHE_IWRITES_CURRENT">Columnar Cache Population - Current</a></li>
            <li><a class="exa" href="#CELL_FLASH_CACHE_SCAN_POP">Flash Cache Scan Population</a></li>
          </ul>
          <!-- make sure we do not display the back to links unless we have config data -->
          <xsl:if test="//config[@type='fc']">
            <p><xsl:apply-templates select="//config[@type='fc']"/></p>
            <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
            <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          </xsl:if>
          <p><xsl:apply-templates select="//cellstats[@type='fc_space']"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          <p><xsl:apply-templates select="//cellstats[@type='fc_ureads']"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          <!-- also display additional FC read efficiency sections -->
          <p><xsl:apply-templates select="//cellstats[@type='fc_ureads']" mode="efficiency"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          <!-- check if we have the CC section -->
          <!-- TODO: check if we always have CC section -->
          <p><xsl:apply-templates select="//cellstats[@type='cc_ureads']"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          <p><xsl:apply-templates select="//cellstats[@type='fc_uwrites']"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          <xsl:if test="$hasFlashCacheLW = 'Y'">
            <p><xsl:apply-templates select="//cellstats[@type='fc_uwrites']" mode="fc_uwrites_lw"/></p>
            <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
            <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          </xsl:if>

          <p><xsl:apply-templates select="//cellstats[@type='fc_ireads']"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          <p><xsl:apply-templates select="//cellstats[@type='fc_iwrites']"/></p>
          <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <!-- check if we have the CC section -->
          <!-- TODO: check if we always have CC section -->
          <p><xsl:apply-templates select="//cellstats[@type='cc_iwrites']" mode="cc_iwrites_delta"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='cc_iwrites']" mode="cc_iwrites_curr"/></p>
          <a class="exa" href="#CELL_FLASH_CACHE">Back to Exadata Flash Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='fcs_pop']"/></p>
          <a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>

          <!-- only display this section if we have RAM cache -->
          <!-- we do not want to display these sections until OSS has it  -->
          <xsl:if test="$hasRamCache = 'Y'">
          <a name="CELL_RAM_CACHE"/>
          <h3 class="exa">Memory Cache</h3>
          <ul class="exa">
            <li><a class="exa" href="#CELL_RAM_CACHE_SPACE">Memory Cache Space Usage</a></li>
            <li><a class="exa" href="#CELL_RAM_CACHE_UREADS">Memory Cache User Reads</a></li>
            <li><a class="exa" href="#CELL_RAM_CACHE_IWRITES">Memory Cache Internal Writes</a></li>
          </ul>
          <p><xsl:apply-templates select="//cellstats[@type='rc_spc']"/></p>
          <a class="exa" href="#CELL_RAM_CACHE">Back to Exadata Memory Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='rc_ureads']"/></p>
          <a class="exa" href="#CELL_RAM_CACHE">Back to Exadata Memory Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='rc_iwrites']"/></p>
          <a class="exa" href="#CELL_RAM_CACHE">Back to Exadata Memory Cache</a>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>

          </xsl:if>

          <a name="CELL_IOREASON"/>
          <h3 class="exa">Exadata IO Reasons</h3>
          <xsl:call-template name="ioReasonToc"/>
          <br/><a class="exa" href="#top">Back to Top</a>
          <p><xsl:apply-templates select="//cellstats[@type='ioreason']" mode="ioreason_by_rq"/></p>
          <p><xsl:apply-templates select="//cellstats[@type='ioreason']" mode="ioreason_by_mb"/></p>
          <a class="exa" href="#CELL_IOREASON">Back to Exadata IO Reasons</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>

          <!-- top database consumers -->
          <a name="CELL_TOPDB"/>
          <h3 class="exa">Exadata Top Database Consumers</h3>
          <xsl:call-template name="topDbConsumerToc"/>
          <br/><a class="exa" href="#top">Back to Top</a>
          <!-- bug22053453: print out warning, if required  -->
          <xsl:apply-templates select="//cellstats[@type='topdb_missing']"/>
          <p><xsl:apply-templates select="//cellstats[@type='topdb']" mode="topdb_by_rq"/></p>

          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='topdb']" mode="topdb_by_rq_detail"/></p>

          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='topdb']" mode="topdb_by_mb"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='dbpercell']" mode="dbpercell_by_rq"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='dbpercell']" mode="dbpercell_by_rq_detail"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='dbpercell']" mode="dbpercell_by_mb"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>

          <!-- IO latency capping -->
          <a name="CELL_IO_CAPPING"/>
          <h3 class="exa">Exadata IO Latency Capping</h3>
          <xsl:call-template name="ioCappingToc"/>
          <p><xsl:apply-templates select="//cellstats[@type='io_capping_asm']"/></p>
          <a class="exa" href="#CELL_IO_CAPPING">Back to Exadata IO Latency Capping</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='io_capping']"/></p>
          <a class="exa" href="#CELL_IO_CAPPING">Back to Exadata IO Latency Capping</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='io_capping_db']"/></p>
          <a class="exa" href="#CELL_IO_CAPPING">Back to Exadata IO Latency Capping</a>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to Exadata Statistics</a>
          <br/>
          <br/><a class="exa" href="#top">Back to Top</a>
          </body>
        </xsl:otherwise>
      </xsl:choose>
    </html>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for max capacity in case of heterogeneous system    -->
  <!-- TODO: if same disktype, but different number of cells then   -->
  <!-- the cell capacity is different, but the disk capacity will   -->
  <!-- be the same                                                  -->
  <!-- ============================================================ -->
  <xsl:template name="setMaxCapacity">
    <xsl:param name="diskType"/>
    <xsl:param name="nodeName"/>
    <xsl:variable name="delimiter">
      <xsl:if test="count(//caps/cap/disk[@dtype=$diskType]) &gt; 1">
        <xsl:value-of select="';'"/>
      </xsl:if>
    </xsl:variable>
    <xsl:for-each select="//caps/cap/disk[@dtype=$diskType]">
      <!-- put on same line so as not to add additional blank lines in html -->
      <xsl:value-of select="./@disk_type"/>: <xsl:apply-templates select="./child::*[name() = $nodeName]" mode="int"/><xsl:value-of select="$delimiter"/>
    </xsl:for-each>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for cell outlier summary                            -->
  <!--  ============================================================ -->
  <xsl:template match="//outlier_summary[@type='cell']">
    <a name="OUTLIER_SUMMARY_CELL"/>
    <!--  check if we need to display messages first -->
    <h4 class="exa">Outlier Summary - Cell Level</h4>
    <ul>
      <xsl:call-template name="outlierMessage">
        <xsl:with-param name="entityType" select="'cells'"/>
        <xsl:with-param name="showColoringMessage" select="'Y'"/>
        <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
      </xsl:call-template>
      <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Maximum cell capacity for hard disks:
           IOPS: <xsl:value-of select="$cellMaxDiskIOPs"/> |
           IO MB/s: <xsl:value-of select="$cellMaxDiskMBPS"/>
        </li>
        <li class="exa">Maximum cell capacity for flash disks:
          IOPS: <xsl:value-of select="$cellMaxFlashIOPs"/> |
          IO MB/s: <xsl:value-of select="$cellMaxFlashMBPS"/> 
        </li>

      <xsl:if test="$showFlashOutliers = 0">
        <li><b>There is insufficient activity on Flash Disks, and Flash Disk outliers will not be displayed</b></li>
      </xsl:if>
      <xsl:if test="$showDiskOutliers = 0">
        <li><b>There is insufficient activity on Hard Disks, and Hard Disk outliers will not be displayed</b></li>
      </xsl:if>
      <xsl:if test="$showFlashOutliers = 1 and count(./cell/disk_type[@dtype='F']/stat) = 0">
         <li><b>There are no cell outliers on flash</b></li>
      </xsl:if>
      <xsl:if test="$showDiskOutliers = 1 and count(./cell/disk_type[@dtype='H']/stat) = 0">
         <li><b>There are no cell outliers on hard disks</b></li>
      </xsl:if>
    </ul>

    <!-- only show this if we have outliers and we exceed thresholds -->
    <xsl:if test="($showFlashOutliers = 1 or $showDiskOutliers = 1) and 
                  count(./cell) &gt; 0">
      <table class="exa" border="0" summary="This table displays a list of cell outliers">
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <th class="exa" colspan="4">Value</th>
          <th class="exa" colspan="4">Typical</th>
        </tr>
        <tr>
          <th class="exa">Cell Name</th>
          <th class="exa">Disk Type</th>
          <th class="exa">Statistic Name</th>
          <th class="exa" colspan="2">Cell</th>
          <th class="exa" colspan="2">per Disk</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
       </tr>
      <xsl:apply-templates select="./cell" mode="outlier_summary"/>
      </table>
    </xsl:if>
 </xsl:template>


  <!--  ============================================================ -->
  <!--  TEMPLATE for disk outlier summary                            -->
  <!--  ============================================================ -->
  <xsl:template match="//outlier_summary[@type='disk']">
    <a name="OUTLIER_SUMMARY_DISK"/>
    <!--  check if we need to display messages first -->
    <h4 class="exa">Outlier Summary - Disk Level</h4>
    <ul>
      <xsl:call-template name="outlierMessage">
        <xsl:with-param name="entityType" select="'disks'"/>
        <xsl:with-param name="showColoringMessage" select="'Y'"/>
        <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
      </xsl:call-template>
      <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Maximum hard disk capacity:
          IOPS: <xsl:value-of select="$diskMaxDiskIOPs"/> |
          IO MB/s: <xsl:value-of select="$diskMaxDiskMBPS"/>
        </li>
        <li class="exa">Maximum flash disk capacity:
          IOPS: <xsl:value-of select="$diskMaxFlashIOPs"/> |
          IO MB/s: <xsl:value-of select="$diskMaxFlashMBPS"/> 
        </li>

      <!-- display messages to guide the user if there are no rows displayed -->
      <xsl:if test="$showFlashOutliers = 0">
        <li><b>There is insufficient activity on Flash Disks, and Flash Disk outliers will not be displayed</b></li>
      </xsl:if>
      <xsl:if test="$showDiskOutliers = 0">
        <li><b>There is insufficient activity on Hard Disks, and Hard Disk outliers will not be displayed</b></li>
      </xsl:if>
      <xsl:if test="$showFlashOutliers = 1 and count(./disk/disk_type[@dtype='F']/stat) = 0">
         <li><b>There are no disk outliers on flash</b></li>
      </xsl:if>
      <xsl:if test="$showDiskOutliers = 1 and count(./disk/disk_type[@dtype='H']/stat) = 0">
         <li><b>There are no disk outliers on hard disks</b></li>
      </xsl:if>

    </ul>

    <!-- table should only be displayed if we have something to display -->
    <xsl:if test="($showFlashOutliers = 1 or $showDiskOutliers = 1) and 
                  count(./disk) &gt; 0">

      <table class="exa" border="0" summary="This table displays a list of disk outliers">
        <tr>
          <th class="exa">Disk Name</th>
          <th class="exa">Cell Name</th>
          <th class="exa">Disk Type</th>
          <th class="exa">Statistic Name</th>
          <th class="exa" colspan="2">Value</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
        </tr>
        <!--  now process the rows -->
        <!-- process individual columns -->
        <xsl:apply-templates select="./disk" mode="outlier_summary"/>
      </table>
    </xsl:if>    
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for outlier summary - individual rows               -->
  <!--  ============================================================ -->
  <xsl:template match="cell|disk" mode="outlier_summary">
     <xsl:apply-templates select="./disk_type" mode="outlier_summary">
       <xsl:with-param name="cellPosition" select="position()"/>
     </xsl:apply-templates>
  </xsl:template>

 <xsl:template match="disk_type" mode="outlier_summary">
   <xsl:param name="cellPosition"/>
   <xsl:apply-templates select="./stat" mode="outlier_summary">
     <xsl:with-param name="cellPosition" select="$cellPosition"/>
     <xsl:with-param name="diskTypePosition" select="position()"/>
   </xsl:apply-templates>
 </xsl:template>

 <xsl:template match="stat" mode="outlier_summary">
   <xsl:param name="cellPosition"/>
   <xsl:param name="diskTypePosition"/>
   <!-- based on stat, determine if we need to show units -->
   <xsl:variable name="statUnit">
     <xsl:apply-templates select="./@name" mode="getStatUnit"/>
   </xsl:variable>
   <xsl:variable name="toUnit">
     <xsl:apply-templates select="./@mean" mode="getUnit">
       <xsl:with-param name="statUnit" select="$statUnit"/>
     </xsl:apply-templates>
   </xsl:variable>

   <tr class="exa">
     <td>
       <xsl:if test="$diskTypePosition = 1 and position() = 1">
         <xsl:value-of select="../../@name"/>
       </xsl:if>
     </td>
     <xsl:if test="name(../..) = 'disk'">
       <td>
         <xsl:if test="$diskTypePosition = 1 and position() = 1">
           <xsl:value-of select="../../@cell"/>           
         </xsl:if>
       </td>
     </xsl:if>
     <td>
       <xsl:if test="position() = 1">
         <xsl:value-of select="../@disk_type"/>
       </xsl:if>
     </td>
     <td>
       <xsl:apply-templates select="./@name" mode="translate"/>
     </td>
     <xsl:apply-templates select="." mode="outlier_summary_value">
       <xsl:with-param name="statUnit" select="$statUnit"/>
       <xsl:with-param name="toUnit" select="$toUnit"/>
     </xsl:apply-templates>
     <xsl:apply-templates select="." mode="allMean">
       <xsl:with-param name="statUnit" select="$statUnit"/>
       <xsl:with-param name="toUnit" select="$toUnit"/>
     </xsl:apply-templates>
   </tr>
 </xsl:template>

 <!-- display actual stat outlier summary value -->
 <xsl:template match="stat" mode="outlier_summary_value">
   <xsl:param name="statUnit"/>
   <xsl:param name="toUnit"/>

   <xsl:variable name="linkDestination">
     <xsl:apply-templates select="." mode="getLinkDestination"/>
   </xsl:variable>
   <!-- for cells, not cpu metric -->
   <xsl:if test="name(../..) = 'cell'">
     <xsl:choose>
       <!-- if we have a total value,                 -->
       <!--  we display total (with indicator) + value -->
       <xsl:when test="./@tot">
         <xsl:apply-templates select="./@tot" mode="outlier"/>
         <xsl:apply-templates select="./@value" mode="outlier">
           <xsl:with-param name="linkDestination" select="$linkDestination"/>
           <xsl:with-param name="withIndicator" select="'N'"/>
           <xsl:with-param name="statUnit" select="$statUnit"/>
           <xsl:with-param name="toUnit" select="$toUnit"/>
         </xsl:apply-templates>
       </xsl:when>
       <!-- for cpu, put value in cell column -->
       <xsl:when test="./@name = 'cpu' or ./@name = 'usr' or ./@name = 'sys'">
         <xsl:apply-templates select="./@value" mode="outlier">
           <xsl:with-param name="linkDestination" select="$linkDestination"/>
           <xsl:with-param name="statUnit" select="$statUnit"/>
           <xsl:with-param name="toUnit" select="$toUnit"/>
         </xsl:apply-templates>
         <!-- TODO: old version had color for empty cell -->
         <td colspan="2"></td>
       </xsl:when>
       <xsl:otherwise>
         <!-- TODO: old version had color for empty cell -->
         <td colspan="2"></td>
         <xsl:apply-templates select="./@value" mode="outlier">
           <xsl:with-param name="linkDestination" select="$linkDestination"/>
           <xsl:with-param name="statUnit" select="$statUnit"/>
           <xsl:with-param name="toUnit" select="$toUnit"/>
         </xsl:apply-templates>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:if>
   <xsl:if test="name(../..) = 'disk'">
     <xsl:apply-templates select="./@value" mode="outlier">
       <xsl:with-param name="linkDestination" select="$linkDestination"/>
       <xsl:with-param name="statUnit" select="$statUnit"/>
       <xsl:with-param name="toUnit" select="$toUnit"/>
     </xsl:apply-templates>
   </xsl:if>
 </xsl:template>

 <!-- translate stat name to a display name -->
 <xsl:template match="stat/@name" mode="translate">
     <xsl:choose>
       <xsl:when test=". = 'iops'">
         <xsl:value-of select="'IOPs'"/>
       </xsl:when>
       <xsl:when test=". = 'mbps'">
         <xsl:value-of select="'IO MB/s'"/>
       </xsl:when>
       <xsl:when test=". = 'util'">
         <xsl:value-of select="'% Disk Utilization'"/>
       </xsl:when>
       <xsl:when test=". = 'st'">
         <xsl:value-of select="'Service Time'"/>
       </xsl:when>
       <xsl:when test=". = 'wt'">
         <xsl:value-of select="'Wait Time'"/>
       </xsl:when>
       <xsl:when test=". = 'cpu'">
         <xsl:value-of select="'% CPU'"/>
       </xsl:when>
       <xsl:when test=". = 'usr'">
         <xsl:value-of select="'% User CPU'"/>
       </xsl:when>
       <xsl:when test=". = 'sys'">
         <xsl:value-of select="'% System CPU'"/>
       </xsl:when>
       <xsl:when test=". = 'iorq'">
         <xsl:value-of select="'Cell Server IOPs'"/>
       </xsl:when>
       <xsl:when test=". = 'srrq'">
         <xsl:value-of select="'Small Reads/s'"/>
       </xsl:when>
       <xsl:when test=". = 'swrq'">
         <xsl:value-of select="'Small Writes/s'"/>
       </xsl:when>
       <xsl:when test=". = 'lrrq'">
         <xsl:value-of select="'Large Reads/s'"/>
       </xsl:when>
       <xsl:when test=". = 'lwrq'">
         <xsl:value-of select="'Large Writes/s'"/>
       </xsl:when>
       <xsl:when test=". = 'iomb'">
         <xsl:value-of select="'Cell Server IO MB/s'"/>
       </xsl:when>
       <xsl:when test=". = 'srmb'">
         <xsl:value-of select="'Small Read MB/s'"/>
       </xsl:when>
       <xsl:when test=". = 'swmb'">
         <xsl:value-of select="'Small Write MB/s'"/>
       </xsl:when>
       <xsl:when test=". = 'lrmb'">
         <xsl:value-of select="'Large Read MB/s'"/>
       </xsl:when>
       <xsl:when test=". = 'lwmb'">
         <xsl:value-of select="'Large Write MB/s'"/>
       </xsl:when>
       <xsl:when test=". = 'ap'">
         <xsl:value-of select="'Cell IO Latency'"/>
       </xsl:when>
       <xsl:when test=". = 'sr'">
         <xsl:value-of select="'Small Read Latency'"/>
       </xsl:when>
       <xsl:when test=". = 'sw'">
         <xsl:value-of select="'Small Write Latency'"/>
       </xsl:when>
       <xsl:when test=". = 'lr'">
         <xsl:value-of select="'Large Read Latency'"/>
       </xsl:when>
       <xsl:when test=". = 'lw'">
         <xsl:value-of select="'Large Write Latency'"/>
       </xsl:when>
       <xsl:otherwise>
         <xsl:value-of select="."/>
       </xsl:otherwise>
     </xsl:choose>
 </xsl:template>

 <!-- TEMPLATE to construct link destinatino for outlier summary -->
 <xsl:template match="stat" mode="getLinkDestination">
   <!-- determine if cell or disk -->
   <xsl:variable name="level">
     <xsl:value-of select="name(../..)"/>
   </xsl:variable>
   <!-- determine cell name or disk name -->
   <xsl:variable name="objectName">
     <xsl:value-of select="../../@name"/>
   </xsl:variable>
   <xsl:choose>
     <xsl:when test="$level = 'cell' and (./@name = 'iops' or ./@name = 'mbps' or ./@name = 'util')">
       <xsl:value-of select="concat('#',$linkOsIoOutCell,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'disk' and 
          (./@name = 'iops' or ./@name = 'mbps' or ./@name = 'util')">
       <xsl:value-of select="concat('#',$linkOsIoOutDisk,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'cell' and
                     (./@name = 'st' or ./@name = 'wt')">
       <xsl:value-of select="concat('#',$linkOsLatencyOutCell,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'disk' and
                     (./@name = 'st' or ./@name = 'wt')">
       <xsl:value-of select="concat('#',$linkOsLatencyOutDisk,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'cell' and
                     (./@name = 'cpu' or ./@name = 'usr' or ./@name = 'sys')">
       <xsl:value-of select="concat('#',$linkOsCpuOutCell,$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'cell' and 
          (./@name = 'iorq' or ./@name = 'srrq' or ./@name = 'swrq' or @name = 'lrrq' or @name = 'lwrq')">
       <xsl:value-of select="concat('#',$linkCellSrvIopsOutCell,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'disk' and 
          (./@name = 'iorq' or ./@name = 'srrq' or ./@name = 'swrq' or @name = 'lrrq' or @name = 'lwrq')">
       <xsl:value-of select="concat('#',$linkCellSrvIopsOutDisk,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'cell' and 
          (./@name = 'iomb' or ./@name = 'srmb' or ./@name = 'swmb' or @name = 'lrmb' or @name = 'lwmb')">
       <xsl:value-of select="concat('#',$linkCellSrvMbpsOutCell,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'disk' and 
          (./@name = 'iomb' or ./@name = 'srmb' or ./@name = 'swmb' or @name = 'lrmb' or @name = 'lwmb')">
       <xsl:value-of select="concat('#',$linkCellSrvMbpsOutDisk,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'cell' and 
          (./@name = 'ap' or ./@name = 'sr' or ./@name = 'sw' or @name = 'lr' or @name = 'lw')">
       <xsl:value-of select="concat('#',$linkCellSrvLatencyOutCell,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
     <xsl:when test="$level = 'disk' and 
          (./@name = 'ap' or ./@name = 'sr' or ./@name = 'sw' or @name = 'lr' or @name = 'lw')">
       <xsl:value-of select="concat('#',$linkCellSrvLatencyOutDisk,translate(../@disk_type,'/','_'),$objectName)"/>
     </xsl:when>
   </xsl:choose>
 </xsl:template>

 <!-- template for displaying no outlier message -->
 <xsl:template match="cellstats" mode="check_outlier_msg">
   <xsl:if test="$showFlashOutliers = 1 and ./cells and count(./cells[substring(@disk_type,1,1)='F']/cell/stat[(@bkt &gt;= $cellThreshold or @bkt &lt;= 0-$cellThreshold) and not(@mgn)]) = 0">
     <li class="exa"><b>There are no cell outliers on flash</b></li>
     </xsl:if>
     <xsl:if test="$showDiskOutliers = 1 and ./cells and count(./cells[substring(@disk_type,1,1)='H']/cell/stat[(@bkt &gt;= $cellThreshold or @bkt &lt;= 0-$cellThreshold) and not(@mgn)]) = 0">
     <li class="exa"><b>There are no cell outliers on hard disks</b></li>
     </xsl:if>
     <xsl:if test="$showFlashOutliers = 1 and ./disks and count(./disks[substring(@disk_type,1,1)='F']/disk/stat[(@bkt &gt;= $diskThreshold or @bkt &lt;= 0-$diskThreshold) and not(@mgn)]) = 0">
     <li class="exa"><b>There are no disk outliers on flash</b></li>
     </xsl:if>
     <xsl:if test="$showDiskOutliers = 1 and ./disks and count(./disks[substring(@disk_type,1,1)='H']/disk/stat[(@bkt &gt;= $cellThreshold or @bkt &lt;= 0-$cellThreshold) and not(@mgn)]) = 0">
     <li class="exa"><b>There are no disk outliers on hard disks</b></li>
     </xsl:if>

 </xsl:template>

  <!-- ========================================================== -->
  <!-- TEMPLATE for displaying Cell OS IO Outliers - Cell Level   -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cell_osstat']" mode="outlier">
    <a name="OS_IO_CELL"/>
    <h4 class="exa">Exadata OS IO Statistics - Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="./cells">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
            <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
          </xsl:call-template> 
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">%Total - Avg [IOPs |IO MB/s] of the cell as a percentage of total [IOPs | IO MB/s] for the disk type</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays cell outliers of OS statistics">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" id="IOPs" colspan="8">IOPs</th>
            <th class="exa" id="IOMBPs" colspan="8">IO MB/s</th>
            <th class="exa" id="Util" colspan="4" rowspan="2">% Disk Utilization</th>
          </tr>
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" rowspan="2">Total</th>
            <th class="exa" rowspan="2">% Total</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" rowspan="2">Total</th>
            <th class="exa" rowspan="2">% Total</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa"># Cells</th>
            <th class="exa"># Disks</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the cells -->
          <xsl:apply-templates select="./cells/cell" mode="cell_osstat"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>              
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE cell_osstat rows -->
  <xsl:template match="cell" mode="cell_osstat">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="cell_osstat_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE cell_osstat 'All' row -->
  <xsl:template match="cell[@name = $NAME_ALL]" mode="cell_osstat_row">
    <xsl:param name="diskTypeRank"/>

    <tr>
      <!-- determine if we need to draw top border for row -->
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <!-- concatenate exat class as well -->
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>            
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:value-of select="../@num_cells"/></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <!-- iops -->
      <xsl:apply-templates select="./stat[@name='iops']/@tot" mode="allTotal"/>
      <xsl:apply-templates select="./stat[@name='iops']" mode="allMean"/>
      <!-- mbps -->
      <xsl:apply-templates select="./stat[@name='mbps']/@tot" mode="allTotal"/>
      <xsl:apply-templates select="./stat[@name='mbps']" mode="allMean"/>
      <!-- du -->
      <xsl:apply-templates select="./stat[@name='util']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE cell_osstat outlier rows -->
  <xsl:template match="cell[not(@name = $NAME_ALL)]" mode="cell_osstat_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkOsOutDetailCell,translate(../@disk_type,'/','_'),./@name)"/>
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td>
        <!-- drop anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsIoOutCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <!-- iops -->
      <td></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iops']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iops']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='iops']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- mbps -->
      <td></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='mbps']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='mbps']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='mbps']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"/>
      <!-- utilization -->
      <xsl:apply-templates select="./stat[@name='util']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- TEMPLATE for displaying Cell OS IO Outliers - Disk Level   -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='disk_osstat']" mode="outlier">
    <a name="OS_IO_DISK"/>
    <h4 class="exa">Exadata OS IO Statistics - Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_osstat']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'disks'"/>
            <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">% Total - Avg [IOPs |IO MB/s] of the disk as a percentage of total [IOPs | IO MB/s] for the disk type</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays disk outliers of OS statistics">
          <tr class="exa">
          <td bgColor="White"></td>
          <td bgColor="White"></td>
          <td bgColor="White"></td>
          <td bgColor="White"></td>
          <th class="exa" colspan="5">IOPs</th>
          <th class="exa" colspan="5">IO MB/s</th>
          <th class="exa" colspan="4">% Disk Utilization</th>
          </tr>
          <tr class="exa">
          <th class="exa">Disk Type</th>
          <th class="exa">Cell Name</th>
          <th class="exa">Disk Name</th>
          <th class="exa"># Disks</th>
          <th class="exa">% Total</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
          <th class="exa">% Total</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
          </tr>
          <!--  get the disks -->
          <xsl:apply-templates select="./disks/disk" mode="disk_osstat"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_osstat rows -->
  <xsl:template match="disk" mode="disk_osstat">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="disk_osstat_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE disk_osstat 'All' row -->
  <xsl:template match="disk[@name = $NAME_ALL]" mode="disk_osstat_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>            
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td><xsl:value-of select="./@name"/></td>
      <td align="right" class="exabr"><xsl:value-of select="../@num_disks"/></td>
      <td></td>
      <xsl:apply-templates select="./stat[@name='iops']" mode="allMean"/>
      <td></td>
      <xsl:apply-templates select="./stat[@name='mbps']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='util']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- TEMPLATE disk_osstat outlier rows -->
  <xsl:template match="disk[not(@name = $NAME_ALL)]" mode="disk_osstat_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkOsOutDetailDisk,translate(../@disk_type,'/','_'),./@name)"/>

    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td>
      <!-- drop anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsIoOutDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>          
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
        </td>
      <td class="exabr"></td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='iops']/@pct" mode="number"/>
      </td>
      <xsl:apply-templates select="./stat[@name='iops']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='mbps']/@pct" mode="number"/>
      </td>
      <xsl:apply-templates select="./stat[@name='mbps']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='util']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>


  <!-- ========================================================== -->
  <!-- TEMPLATE for displaying IO Latency Outliers - Cell Level   -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cell_latency']" mode="outlier">
    <a name="OS_LATENCY_CELL"/>
    <h4 class="exa">Exadata OS IO Latency - Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_latency']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays cell outliers of I/O latency statistics">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="4">Avg Service Time</th>
            <th class="exa" colspan="4">Avg Wait Time</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa"># Cells</th>
            <th class="exa"># Disks</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the cells -->
          <xsl:apply-templates select="./cells" mode="cell_latency"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="cell_latency">
    <!-- determine unit -->
    <xsl:variable name="unitSt">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='st']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <xsl:variable name="unitWt">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='wt']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- apply template for individual rows -->
    <xsl:apply-templates select="./cell" mode="cell_latency">
      <xsl:with-param name="unitSt" select="$unitSt"/>
      <xsl:with-param name="unitWt" select="$unitWt"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- TEMPLATE cell_latency individual rows -->
  <xsl:template match="cell" mode="cell_latency">
    <xsl:param name="unitSt" select="'ms'"/>
    <xsl:param name="unitWt" select="'ms'"/>
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="cell_latency_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
        <xsl:with-param name="unitSt" select="$unitSt"/>
        <xsl:with-param name="unitWt" select="$unitWt"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE cell_latency 'All' node -->
  <xsl:template match="cell[@name=$NAME_ALL]" mode="cell_latency_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="unitSt"/>
    <xsl:param name="unitWt"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>            
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:value-of select="../@num_cells"/></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <xsl:apply-templates select="./stat[@name='st']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitSt"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='wt']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitWt"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- TEMPLATE cell_latency outlier rows -->
  <xsl:template match="cell[not(@name = $NAME_ALL)]" mode="cell_latency_row">
    <xsl:param name="unitSt"/>
    <xsl:param name="unitWt"/>
    <xsl:variable name="linkDestination" select="concat('#',$linkOsOutDetailCell,translate(../@disk_type,'/','_'), ./@name)"/>

    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td>
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsLatencyOutCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to outlier details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <xsl:apply-templates select="./stat[@name='st']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitSt"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='wt']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitWt"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- TEMPLATE for displaying IO Latency Outliers- Disk Level   -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='disk_latency']" mode="outlier">
    <a name="OS_LATENCY_DISK"/>
    <h4 class="exa">Exadata OS IO Latency - Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_latency']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'disks'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays disk outliers of I/O latency statistics">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="4">Avg Service Time</th>
            <th class="exa" colspan="4">Avg Wait Time</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the disks -->
          <xsl:apply-templates select="disks" mode="disk_latency"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_latency disks -->
  <xsl:template match="disks" mode="disk_latency">
    <!-- determine unit -->
    <xsl:variable name="unitSt">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='st']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <xsl:variable name="unitWt">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='wt']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- apply template for individual rows -->
    <xsl:apply-templates select="./disk" mode="disk_latency">
      <xsl:with-param name="unitSt" select="$unitSt"/>
      <xsl:with-param name="unitWt" select="$unitWt"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- TEMPLATE disk_latency rows -->
  <xsl:template match="disk" mode="disk_latency">
    <xsl:param name="unitSt" select="'ms'"/>
    <xsl:param name="unitWt" select="'ms'"/>
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="disk_latency_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
        <xsl:with-param name="unitSt" select="$unitSt"/>
        <xsl:with-param name="unitWt" select="$unitWt"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE disk_latency 'All' row -->
  <xsl:template match="disk[@name = $NAME_ALL]" mode="disk_latency_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="unitSt"/>
    <xsl:param name="unitWt"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>            
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr"><xsl:value-of select="./@name"/></td>
      <xsl:apply-templates select="./stat[@name='st']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitSt"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='wt']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitWt"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>


  <!-- TEMPLATE disk_latency outlier rows -->
  <xsl:template match="disk[not(@name = $NAME_ALL)]" mode="disk_latency_row">
    <xsl:param name="unitSt"/>
    <xsl:param name="unitWt"/>
    <xsl:variable name="linkDestination" select="concat('#',$linkOsOutDetailDisk,translate(../@disk_type,'/','_'), ./@name)"/>
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsLatencyOutDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <xsl:apply-templates select="./stat[@name='st']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitSt"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='wt']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitWt"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>


  <!-- ========================================================== -->
  <!-- TEMPLATE FOR Cell OS CPU Statistics Outliers               -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cpu']" mode="outlier">
    <a name="OS_CPU_CELL"/>
    <h4 class="exa">Exadata OS CPU Statistics - Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cpu']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
          </xsl:call-template>
          <li class="exa">Outliers for CPU are displayed when CPU exceeds <xsl:value-of select="$thresholdCpu"/>%</li>
          <xsl:if test="$showCpuOutliers = 0"> 
            <li>Outliers for CPU will not be displayed.  The mean CPU usage is only <xsl:value-of select="$currCpu"/>%</li>
          </xsl:if>      
          <xsl:if test="$showCpuOutliers = 1 and ./cells/cell/stat[(@bkt &gt;= $cellThreshold or @bkt &lt;= $cellThreshold) and not(@mgn)]">
            <li class="exa"><b>There are no cell outliers for cpu</b></li>
          </xsl:if>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays cell outliers of cell cpu statistics">
          <tr class="exa">
          <td bgColor="White"></td>
          <td bgColor="White"></td>
          <th class="exa" colspan="4">% CPU Usage</th>
          <th class="exa" colspan="4">% User CPU</th>
          <th class="exa" colspan="4">% System CPU</th>
          </tr>
          <tr class="exa">
          <th class="exa">Cell Name</th>
          <th class="exa"># Cells</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
          <th class="exa" colspan="2">Mean</th>
          <th class="exa">Std Dev</th>
          <th class="exa">Normal Range</th>
          </tr>
          <!--  get the cells -->
          <xsl:apply-templates select="./cells/cell" mode="cpu"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cpu cells -->
  <xsl:template match="cell" mode="cpu">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="'C'"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="cpu_row"/>      
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE cpu 'All' node -->
  <xsl:template match="cell[@name = $NAME_ALL]" mode="cpu_row">
    <!-- no disk types here, so no borders need to be drawn -->
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right" class="exabr"><xsl:value-of select="../@num_cells"/></td>
      <xsl:apply-templates select="./stat[@name='cpu']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='usr']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='sys']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- TEMPLATE cpu outlier rows -->
  <xsl:template match="cell[not(@name = $NAME_ALL)]" mode="cpu_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkOsCpuTopCell, ./@name)"/>
    <tr class="exa">
      <td>
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsCpuOutCell,./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to top section only if rank is in top n-->
        <xsl:apply-templates select="." mode="createLink">
          <xsl:with-param name="linkDestination" select="$linkDestination"/>
        </xsl:apply-templates>
      </td>
      <td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='cpu']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='usr']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='sys']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- NAME: top cells by IOPs                                    -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cell_osstat']" mode="top">
    <a name="OS_IO_CELL_TOP"/>
    <h4 class="exa">Exadata OS IO Statistics - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_osstat']/cells">
       <ul>
         <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
        <xsl:call-template name="topMessageForColor">
          <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
        </xsl:call-template>
        <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Maximum cell capacity for hard disks:
          IOPS: <xsl:value-of select="$cellMaxDiskIOPs"/> |
          IO MB/s: <xsl:value-of select="$cellMaxDiskMBPS"/>
        </li>
        <li class="exa">Maximum cell capacity for flash disks:
          IOPS: <xsl:value-of select="$cellMaxFlashIOPs"/> |
          IO MB/s: <xsl:value-of select="$cellMaxFlashMBPS"/>
        </li>
        <li class="exa">Within each disk type, the top cells by Avg IOPs are displayed</li>
        <li class="exa">%Total - Avg [IOPs | IO MB/s] as a percentage of total [IOPs | IO MB/s] for the disk type</li>
        <li class="exa">Ordered by Disk Type, IOPs desc</li>
        <xsl:apply-templates select="./cells" mode="cell_osstat_top_header"/>
       </ul>
       <table class="exa" border="0" summary="This table displays the top cells by IOPs">
         <tr>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <th class="exa" colspan="3">IOPs</th>
           <th class="exa" colspan="3">IO MB/s</th>
           <th class="exa" colspan="2">%Disk Utilization</th>
         </tr>
         <tr>
           <th class="exa">Disk Type</th>
           <th class="exa">Cell Name</th>
           <th class="exa">%Total</th>
           <th class="exa" colspan="2">Avg</th>
           <th class="exa">%Total</th>
           <th class="exa" colspan="2">Avg</th>
           <th class="exa" colspan="2">Avg</th>
         </tr>
         <!-- retrieve cells in sorted order -->
         <xsl:apply-templates select="./cells" mode="cell_osstat_top"/>
       </table>
     </xsl:when>
     <xsl:otherwise>
       <p><xsl:value-of select="$noDataMsg"/></p>
     </xsl:otherwise>
   </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_osstat top cells - header summary -->
  <xsl:template match="cells" mode="cell_osstat_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average:
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='iops']/@tot" mode="avgValue"/> IOPs,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='mbps']/@tot" mode="avgValue"/> IO MB/s,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='util']/@mean" mode="number"/> % Disk Utilization
    </li>
  </xsl:template>

  <!-- TEMPLATE celll_osstat top cells by disk type- rows -->
  <xsl:template match="cells" mode="cell_osstat_top">
    <!-- retrieve cells in sorted order -->
    <xsl:for-each select="./cell[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="cell_osstat_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE cell_osstat top cell - individual rows -->
  <xsl:template match="cell" mode="cell_osstat_top_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td class="exabr">
        <!-- drop anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsIoTopCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iops']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iops']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <td align="right"><xsl:apply-templates select="./stat[@name='mbps']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='mbps']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='util']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- NAME: top disks by IOPs                                    -->
  <!-- DESCRIPTION: For displaying Top Disks by IOPs              -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='disk_osstat']" mode="top">
   <a name="OS_IO_DISK_TOP"/>
   <h4 class="exa">Exadata OS IO Statistics - Top Disks</h4>
   <xsl:choose>
     <xsl:when test="//cellstats[@type='disk_osstat']/disks">
       <ul>
         <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
        <xsl:call-template name="topMessageForColor">
          <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
        </xsl:call-template>
        <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Maximum hard disk capacity:
          IOPS: <xsl:value-of select="$diskMaxDiskIOPs"/> |
          IO MB/s: <xsl:value-of select="$diskMaxDiskMBPS"/>
        </li>
        <li class="exa">Maximum flash disk capacity:
          IOPS: <xsl:value-of select="$diskMaxFlashIOPs"/> |
          IO MB/s: <xsl:value-of select="$diskMaxFlashMBPS"/> 
        </li>
        <li class="exa">Within each disk type, the top disks by Avg IOPs are displayed</li>
        <li class="exa">%Total - Avg [IOPs | IO MB/s] as a percentage of the total [IOPs | IO MB/s] for the disk type</li>
        <li class="exa">Ordered by Disk Type, IOPs desc</li>
        <xsl:apply-templates select="./disks" mode="disk_osstat_top_header"/>
       </ul>
       <table class="exa" border="0" summary="This table displays the top disks by IOPs">
         <tr>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <th class="exa" colspan="3">IOPs</th>
           <th class="exa" colspan="3">IO MB/s</th>
           <th class="exa" colspan="2">%Disk Utilization</th>
         </tr>
         <tr>
           <th class="exa">Disk Type</th>
           <th class="exa">Cell Name</th>
           <th class="exa">Disk Name</th>
           <th class="exa">%Total</th>
           <th class="exa" colspan="2">Avg</th>
           <th class="exa">%Total</th>
           <th class="exa" colspan="2">Avg</th>
           <th class="exa" colspan="2">Avg</th>
         </tr>
         <xsl:apply-templates select="disks" mode="disk_osstat_top"/>
       </table>
     </xsl:when>
     <xsl:otherwise>
       <p><xsl:value-of select="$noDataMsg"/></p>
     </xsl:otherwise>
   </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_osstat top disks - header summary -->
  <xsl:template match="disks" mode="disk_osstat_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average:
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='iops']/@mean" mode="number"/> IOPs,
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='mbps']/@mean" mode="number"/> IO MB/s,
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='util']/@mean" mode="number"/> % Disk Utilization
    </li>
  </xsl:template>

  <!-- TEMPLATE disk_osstat top disks by disk type - rows -->
  <xsl:template match="disks" mode="disk_osstat_top">
    <!-- retrieve disks in sorted order -->
    <xsl:for-each select="./disk[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="disk_osstat_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <xsl:template match="disk" mode="disk_osstat_top_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsIoTopDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iops']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iops']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <td align="right"><xsl:apply-templates select="./stat[@name='mbps']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='mbps']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='util']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ================================================================ -->
  <!--  NAME: top cells by latency                                      -->
  <!-- ================================================================ -->
  <xsl:template match="//cellstats[@type='cell_latency']" mode="top">
    <a name="OS_LATENCY_CELL_TOP"/>
    <h4 class="exa">Exadata OS IO Latency - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_latency']/cells">
        <ul>
        <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
        <xsl:call-template name="topMessageForColor"/>
        <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Within each disk type, the top cells by Wait Time are displayed</li>
        <li class="exa">Ordered by Disk Type, Avg Wait Time desc</li>
        <xsl:apply-templates select="./cells" mode="cell_latency_top_header"/>
       </ul>
       <table class="exa" border="0" summary="This table displays the top cells by Wait time">
         <tr>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <th class="exa" colspan="4">Average Times</th>
         </tr>
         <tr>
           <th class="exa">Disk Type</th>
           <th class="exa">Cell Name</th>
           <th class="exa" colspan="2">Service Time</th>
           <th class="exa" colspan="2">Wait Time</th>
         </tr>
         <xsl:apply-templates select="./cells" mode="cell_latency_top"/>
       </table>
     </xsl:when>
     <xsl:otherwise>
       <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_latency top cells - header summary -->
  <xsl:template match="cells" mode="cell_latency_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average:
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='st']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates> Service Time,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='wt']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates> Wait Time
    </li>
  </xsl:template>

  <!-- TEMPLATE cell_latency top cells - by disk type -->
  <xsl:template match="cells" mode="cell_latency_top">
    <!-- determine unit for 'st' and 'wt' -->
    <xsl:variable name="unitSt">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='st']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <xsl:variable name="unitWt">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='wt']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- retrieve cells in sorted order -->
    <xsl:for-each select="./cell[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="cell_latency_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
        <xsl:with-param name="unitSt" select="$unitSt"/>
        <xsl:with-param name="unitWt" select="$unitWt"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE cell_latency top cells - individual rows -->
  <xsl:template match="cell" mode="cell_latency_top_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="unitSt"/>
    <xsl:param name="unitWt"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsLatencyTopCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <xsl:apply-templates select="./stat[@name='st']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitSt"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='wt']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitWt"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>


  <!-- ================================================================ -->
  <!--  NAME: top disks by latency                                      -->
  <!-- ================================================================ -->
  <xsl:template match="//cellstats[@type='disk_latency']" mode="top">
    <a name="OS_LATENCY_DISK_TOP"/>
    <h4 class="exa">Exadata OS IO Latency - Top Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_latency']/disks">
       <ul>
         <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
        <xsl:call-template name="topMessageForColor"/>
        <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Within each disk type, the top disks by Wait Time are displayed</li>
        <li class="exa">Ordered by Disk Type, Avg Wait Time desc</li>
        <xsl:apply-templates select="./disks" mode="disk_latency_top_header"/>
       </ul>
       <table class="exa" border="0" summary="This table displays the top disks by wait time">
         <tr>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <th class="exa" colspan="10">Average Times</th>
         </tr>
         <tr>
           <th class="exa">Disk Type</th>
           <th class="exa">Cell Name</th>
           <th class="exa">Disk Name</th>
           <th class="exa" colspan="2">Service Time</th>
           <th class="exa" colspan="2">Wait Time</th>
         </tr>
         <xsl:apply-templates select="./disks" mode="disk_latency_top"/>
       </table>
     </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_latency top disks - header summary -->
  <xsl:template match="disks" mode="disk_latency_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average:
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='st']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates> Service Time,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='wt']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates> Wait Time
    </li>
  </xsl:template>

  <!-- TEMPLATE disk_latency top disks - by disk type -->
  <xsl:template match="disks" mode="disk_latency_top">
    <!-- determine unit for st and wt -->
    <xsl:variable name="unitSt">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='st']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <xsl:variable name="unitWt">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='wt']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- retrieve disks in sorted order -->
    <xsl:for-each select="./disk[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="disk_latency_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
        <xsl:with-param name="unitSt" select="$unitSt"/>
        <xsl:with-param name="unitWt" select="$unitWt"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE disk_latency top disks - individual rows -->
  <xsl:template match="disk" mode="disk_latency_top_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="unitSt"/>
    <xsl:param name="unitWt"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsLatencyTopDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <xsl:apply-templates select="./stat[@name='st']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitSt"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='wt']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$unitWt"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>


  <!-- ================================================================ -->
  <!--  NAME: top cells by cpu                                          -->
  <!-- ================================================================ -->
  <xsl:template match="//cellstats[@type='cpu']" mode="top">
    <a name="OS_CPU_CELL_TOP"/>
    <h4 class="exa">Exadata OS CPU Statistics - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cpu']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
        <xsl:call-template name="topMessageForColor"/>
         <li class="exa">The top cells by %CPU are displayed</li>
         <li class="exa">Ordered by % CPU desc</li>
         <xsl:apply-templates select="./cells" mode="cpu_top_header"/>
        </ul>
        <table class="exa" border="0" summary="This table displays the top cells by CPU">
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa" colspan="2">% CPU</th>
            <th class="exa" colspan="2">% User</th>
            <th class="exa" colspan="2">% Sys</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="cpu_top"/>
       </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cpu top cells - header summary -->
  <xsl:template match="cells" mode="cpu_top_header">
    <li class="exa">Average:
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='cpu']/@mean" mode="number"/> % CPU,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='usr']/@mean" mode="number"/> % User,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='sys']/@mean" mode="number"/> % Sys
    </li>
  </xsl:template>

  <!-- TEMPLATE cpu top cells -->
  <xsl:template match="cells" mode="cpu_top">
    <!-- retrieve cells in sorted order -->
    <xsl:for-each select="./cell[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="cpu_top_row"/>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE cpu top cells - individual rows -->
  <xsl:template match="cell" mode="cpu_top_row">
    <tr class="exa">
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkOsCpuTopCell,./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <xsl:apply-templates select="./stat[@name='cpu']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='usr']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sys']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- TEMPLATE for displaying Cell OS IO Outliers - Cell Level   -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cell_srviorq']" mode="outlier">
    <a name="CELLSRV_IOPS_CELL"/>
    <h4 class="exa">Exadata Cell Server IOPS Statistics - Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_srviorq']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
        <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">% Total - Avg IOPs of the cell as a percentage of total IOPs for the disk type</li>
        <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays cell outliers of cell server IOPs">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="8">IOPs</th>
            <th class="exa" colspan="6">Small Reads/s</th>
            <th class="exa" colspan="6">Small Writes/s</th>
            <th class="exa" colspan="6">Large Reads/s</th>
            <th class="exa" colspan="6">Large Writes/s</th>
          </tr>
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" rowspan="2">Total</th>
            <th class="exa" rowspan="2">% Total</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa"># Cells</th>
            <th class="exa"># Disks</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the cells -->
          <xsl:apply-templates select="./cells/cell" mode="cell_srviorq"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_srviorq rows -->
  <xsl:template match="cell" mode="cell_srviorq">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="cell_srviorq_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE cell_srviorq 'All' node -->
  <xsl:template match="cell[@name=$NAME_ALL]" mode="cell_srviorq_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:value-of select="../@num_cells"/></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <xsl:apply-templates select="./stat[@name='iorq']/@tot" mode="allTotal"/>
      <xsl:apply-templates select="./stat[@name='iorq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='srrq']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='srrq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='swrq']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='swrq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lrrq']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='lrrq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lwrq']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='lwrq']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- TEMPLATE cell_srviorq outlier rows -->
  <xsl:template match="cell[not(@name = $NAME_ALL)]" mode="cell_srviorq_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkCellSrvOutDetailCell,translate(../@disk_type,'/','_'),./@name)"/> 
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td>
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvIopsOutCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to outlier details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td></td>
      <td class="exabr" align="right"><xsl:value-of select="./@num_disks"/></td>
      <td></td>
      <!-- iorq -->
      <td align="right"><xsl:apply-templates select="./stat[@name='iorq']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iorq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='iorq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- srrq -->
      <xsl:apply-templates select="./stat[@name='srrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- swrq -->
      <xsl:apply-templates select="./stat[@name='swrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lrrq -->
      <xsl:apply-templates select="./stat[@name='lrrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lwrq -->
      <xsl:apply-templates select="./stat[@name='lwrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

 <!-- =========================================================== -->
  <!-- TEMPLATE for displaying Cell OS IO Outliers - Disk Level   -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='disk_srviorq']" mode="outlier">
    <a name="CELLSRV_IOPS_DISK"/>
    <h4 class="exa">Exadata Cell Server IOPS Statistics - Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_srviorq']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'disks'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
        <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">% Total - Avg IOPs of the disk as a percentage of total IOPs for the disk type</li>
        <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays disk outliers of cell server IOPs">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="5">IOPs</th>
            <th class="exa" colspan="4">Small Reads/s</th>
            <th class="exa" colspan="4">Small Writes/s</th>
            <th class="exa" colspan="4">Large Reads/s</th>
            <th class="exa" colspan="4">Large Writes/s</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">% Total</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the disks -->
          <xsl:apply-templates select="./disks/disk" mode="disk_srviorq"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_srviorq rows -->
  <xsl:template match="disk" mode="disk_srviorq">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="disk_srviorq_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE disk_srviorq 'All' node -->
  <xsl:template match="disk[@name = $NAME_ALL]" mode="disk_srviorq_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr"><xsl:value-of select="./@name"/></td>
      <!-- for All we do not display the %Total so we have an extra col -->
      <td></td>
      <xsl:apply-templates select="./stat[@name='iorq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='srrq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='swrq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lrrq']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lwrq']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- TEMPLATE disk_srviorq outlier rows -->
  <xsl:template match="disk[not(@name = $NAME_ALL)]" mode="disk_srviorq_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkCellSrvOutDetailDisk,translate(../@disk_type,'/','_'),./@name)"/> 
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvIopsOutDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to disk in outlier details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iorq']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iorq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='iorq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- srrq -->
      <xsl:apply-templates select="./stat[@name='srrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- swrq -->
      <xsl:apply-templates select="./stat[@name='swrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lrrq -->
      <xsl:apply-templates select="./stat[@name='lrrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lwrq -->
      <xsl:apply-templates select="./stat[@name='lwrq']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

  <!-- =============================================================== -->
  <!-- TEMPLATE for displaying Cell OS IO MB/s Outliers - Cell Level   -->
  <!-- =============================================================== -->
  <xsl:template match="//cellstats[@type='cell_srviomb']" mode="outlier">
    <a name="CELLSRV_MBPS_CELL"/>
    <h4 class="exa">Exadata Cell Server IO MB/s Statistics - Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_srviomb']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">% Total - Avg IO MB/s of the cell as a percentage of total IO MB/s for the disk type</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays cell outliers of cell server IO MB/s">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="8">IO MB/s</th>
            <th class="exa" colspan="6">Small Reads/s</th>
            <th class="exa" colspan="6">Small Writes/s</th>
            <th class="exa" colspan="6">Large Reads/s</th>
            <th class="exa" colspan="6">Large Writes/s</th>
          </tr>
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" rowspan="2">Total</th>
            <th class="exa" rowspan="2">% Total</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
            <th class="exa" colspan="2">Per Cell</th>
            <th class="exa" colspan="4">Per Disk</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa"># Cells</th>
            <th class="exa"># Disks</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the cells -->
          <xsl:apply-templates select="./cells/cell" mode="cell_srviomb"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_srviomb rows -->
  <xsl:template match="cell" mode="cell_srviomb">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="cell_srviomb_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE cell_srviomb 'All' node -->
  <xsl:template match="cell[@name = $NAME_ALL]" mode="cell_srviomb_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:value-of select="../@num_cells"/></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <xsl:apply-templates select="./stat[@name='iomb']/@tot" mode="allTotal"/>
      <xsl:apply-templates select="./stat[@name='iomb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='srmb']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='srmb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='swmb']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='swmb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lrmb']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='lrmb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lwmb']/@tot" mode="getAvg"/>
      <xsl:apply-templates select="./stat[@name='lwmb']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- TEMPLATE cell_srviomb outlier rows -->
  <xsl:template match="cell[not(@name = $NAME_ALL)]" mode="cell_srviomb_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkCellSrvOutDetailCell,translate(../@disk_type,'/','_'),./@name)"/> 
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td>
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvMbpsOutCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to outlier details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td></td>
      <td class="exabr" align="right"><xsl:value-of select="./@num_disks"/></td>
      <td></td>
      <!-- iomb -->
      <td align="righ"><xsl:apply-templates select="./stat[@name='iomb']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iomb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='iomb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- srmb -->
      <xsl:apply-templates select="./stat[@name='srmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- swmb -->
      <xsl:apply-templates select="./stat[@name='swmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lrmb -->
      <xsl:apply-templates select="./stat[@name='lrmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lwmb -->
      <xsl:apply-templates select="./stat[@name='lwmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
    </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying Disk OS IOMB  Outliers - Disk Level  -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='disk_srviomb']" mode="outlier">
    <a name="CELLSRV_MBPS_DISK"/>
    <h4 class="exa">Exadata Cell Server IO MB/s Statistics - Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_srviomb']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'disks'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">% Total - Avg IO MB/s of the disk as a percentage of total IO MB/s for the disk type</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays disk outliers of cell server MB/s">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="5">IO MB/s</th>
            <th class="exa" colspan="4">Small Reads/s</th>
            <th class="exa" colspan="4">Small Writes/s</th>
            <th class="exa" colspan="4">Large Reads/s</th>
            <th class="exa" colspan="4">Large Writes/s</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">% Total</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <xsl:apply-templates select="./disks/disk" mode="disk_srviomb"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_srviomb rows -->
  <xsl:template match="disk" mode="disk_srviomb">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskTypeRank" select="../@rownum"/>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="disk_srviomb_row">
        <xsl:with-param name="diskTypeRank" select="$diskTypeRank"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE disk_srviomb 'All' node -->
  <xsl:template match="disk[@name = $NAME_ALL]" mode="disk_srviomb_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr"><xsl:value-of select="./@name"/></td>
      <td></td>
      <xsl:apply-templates select="./stat[@name='iomb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='srmb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='swmb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lrmb']" mode="allMean"/>
      <xsl:apply-templates select="./stat[@name='lwmb']" mode="allMean"/>
    </tr>
  </xsl:template>

  <!-- TEMPLATE disk_srviomb outlier rows -->
  <xsl:template match="disk[not(@name = $NAME_ALL)]" mode="disk_srviomb_row">
    <xsl:variable name="linkDestination" select="concat('#',$linkCellSrvOutDetailDisk,translate(../@disk_type,'/','_'),./@name)"/> 
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvMbpsOutDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to outlier details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iomb']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iomb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- srmb -->
      <xsl:apply-templates select="./stat[@name='srmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- swmb -->
      <xsl:apply-templates select="./stat[@name='swmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lrmb -->
      <xsl:apply-templates select="./stat[@name='lrmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <!-- lwmb -->
      <xsl:apply-templates select="./stat[@name='lwmb']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

  <!-- ================================================================== -->
  <!-- TEMPLATE for displaying cellsrv IO Latency Outliers - Cell Level   -->
  <!-- ================================================================== -->
  <xsl:template match="//cellstats[@type='cell_srvlatency']" mode="outlier">
    <a name="CELLSRV_LATENCY_CELL"/>
    <h4 class="exa">Exadata Cell Server IO Latency - Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_srvlatency']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays cell outliers of cell I/O latency ">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="4">Cell Latency</th>
            <th class="exa" colspan="4">Small Read</th>
            <th class="exa" colspan="4">Small Write</th>
            <th class="exa" colspan="4">Large Read</th>
            <th class="exa" colspan="4">Large Write</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa"># Cells</th>
            <th class="exa"># Disks</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the cells -->
          <xsl:apply-templates select="cells" mode="cell_srvlatency"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="cell_srvlatency">
    <!-- determine unit -->
    <xsl:variable name="unit">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- apply template for individual rows -->
    <xsl:apply-templates select="./cell" mode="cell_srvlatency">
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- TEMPLATE cell_srvlatency rows -->
  <xsl:template match="cell" mode="cell_srvlatency">
    <xsl:param name="toUnit"/>
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="cell_srvlatency_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE cell_srvlatency 'All' node -->
  <xsl:template match="cell[@name = $NAME_ALL]" mode="cell_srvlatency_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="toUnit"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>            
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:value-of select="../@num_cells"/></td>
      <td align="right" class="exabr"><xsl:value-of select="./@num_disks"/></td>
      <xsl:apply-templates select="./stat[@name='ap']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sr']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sw']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lr']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lw']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- TEMPLATE cell_srvlatency outlier rows -->
  <xsl:template match="cell[not(@name = $NAME_ALL)]" mode="cell_srvlatency_row">
    <xsl:param name="toUnit"/>
    <xsl:variable name="linkDestination" select="concat('#',$linkCellSrvOutDetailCell,translate(../@disk_type,'/','_'), ./@name)"/>
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td>
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvLatencyOutCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to outlier details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td></td>
      <td class="exabr" align="right"><xsl:value-of select="./@num_disks"/></td>
      <xsl:apply-templates select="./stat[@name='ap']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='sr']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='sw']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='lr']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='lw']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>    
  </xsl:template>

  <!-- =============================================================== -->
  <!-- TEMPLATE for displaying cellsrv  Latency Outliers- Disk Level   -->
  <!-- =============================================================== -->
  <xsl:template match="//cellstats[@type='disk_srvlatency']" mode="outlier">
    <a name="CELLSRV_LATENCY_DISK"/>
    <h4 class="exa">Exadata Cell Server IO Latency - Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_srvlatency']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'disks'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays outliers of cell statistics">
          <tr class="exa">
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="4">Cell Latency</th>
            <th class="exa" colspan="4">Small Read</th>
            <th class="exa" colspan="4">Small Write</th>
            <th class="exa" colspan="4">Large Read</th>
            <th class="exa" colspan="4">Large Write</th>
          </tr>
          <tr class="exa">
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Normal Range</th>
          </tr>
          <!--  get the disks -->
          <xsl:apply-templates select="disks" mode="disk_srvlatency"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency disks -->
  <xsl:template match="disks" mode="disk_srvlatency">
    <!-- determine unit -->
    <xsl:variable name="unit">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <xsl:apply-templates select="./disk" mode="disk_srvlatency">
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency disk rows -->
  <xsl:template match="disk" mode="disk_srvlatency">
    <xsl:param name="toUnit"/>
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRow">
        <xsl:with-param name="diskType" select="../@disk_type"/>        
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:if test="$showRow &gt; 0">
      <xsl:apply-templates select="." mode="disk_srvlatency_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
    </xsl:if>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency 'All' node -->
  <xsl:template match="disk[@name = $NAME_ALL]" mode="disk_srvlatency_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="toUnit"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="$diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td><xsl:value-of select="../@disk_type"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr"><xsl:value-of select="./@name"/></td>
      <xsl:apply-templates select="./stat[@name='ap']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sr']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sw']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lr']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lw']" mode="allMean">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency outlier rows -->
  <xsl:template match="disk[not(@name = $NAME_ALL)]" mode="disk_srvlatency_row">
    <xsl:param name="toUnit"/>
    <!-- create link to outlier detail -->
    <xsl:variable name="linkDestination" select="concat('#',$linkCellSrvOutDetailDisk,translate(../@disk_type,'/','_'), ./@name)"/>
    <tr class="exa">
      <td><xsl:value-of select="$outlierString"/></td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <!-- create anchor -->
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvLatencyOutDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <!-- create link to outlier detail -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="$linkDestination"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <xsl:apply-templates select="./stat[@name='ap']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='sr']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='sw']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='lr']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
      <xsl:apply-templates select="./stat[@name='lw']/@value" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
      </xsl:apply-templates>
      <td></td><td class="exabr"></td>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- TEMPLATE top cells by cell srv IOPs                        -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cell_srviorq']" mode="top">
    <a name="CELLSRV_IOPS_CELL_TOP"/>
    <h4 class="exa">Exadata Cell Server IOPS Statistics - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_srviorq']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="topMessageForColor"/>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Within each disk type, the top cells by Avg IOPs are displayed</li>
          <li class="exa">%Total - Avg IOPs as a percentage of the IOPs for the disk type</li>
          <li class="exa">Ordered by Disk Type, IOPs desc</li>
          <xsl:apply-templates select="./cells" mode="cell_srviorq_top_header"/>
        </ul>
        <table class="exa" border="0" summary="This table displays top cells by cell server IO requests">
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="3">IOPs</th>
            <th class="exa" colspan="8">Average Per Second</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">% Total</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Small Reads</th>
            <th class="exa" colspan="2">Small Writes</th>
            <th class="exa" colspan="2">Large Reads</th>
            <th class="exa" colspan="2">Large Writes</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="cell_srviorq_top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_srviorq top cells - header summary -->
  <xsl:template match="cells" mode="cell_srviorq_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average Requests:
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='iorq']/@tot" mode="avgValue"/> IOPs,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='srrq']/@tot" mode="avgValue"/> Small Reads,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='swrq']/@tot" mode="avgValue"/> Small Writes,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='lrrq']/@tot" mode="avgValue"/> Large Reads,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='lwrq']/@tot" mode="avgValue"/> Large Writes
    </li>
  </xsl:template>

  <!-- TEMPLATE cell_srviorq top cells - by disk type -->
  <xsl:template match="cells" mode="cell_srviorq_top">
    <!-- retrieve cells in sorted order -->
    <xsl:for-each select="./cell[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="cell_srviorq_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE cell_srviorq top cells - individual rows -->
  <xsl:template match="cell" mode="cell_srviorq_top_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvIopsTopCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iorq']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iorq']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srrq']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swrq']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrrq']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwrq']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>


  <!-- ========================================================== -->
  <!-- NAME: top disks by cellsrv IOPs                            -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='disk_srviorq']" mode="top">
    <a name="CELLSRV_IOPS_DISK_TOP"/>
    <h4 class="exa">Exadata Cell Server IOPS - Top Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_srviorq']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="topMessageForColor"/>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Within each disk type, the top disks by Avg IOPs are displayed</li>
          <li class="exa">%Total - Avg IOPs as a percentage of the total IOPs for the disk type</li>
          <li class="exa">Ordered by Disk Type, IOPs desc</li>
          <xsl:apply-templates select="./disks" mode="disk_srviorq_top_header"/>
        </ul>
        <table class="exa" border="0" summary="This table displays the top disks by cell server IOPs">
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="3">IOPs</th>
            <th class="exa" colspan="8">Average Per Second</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">%Total</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Small Reads</th>
            <th class="exa" colspan="2">Small Writes</th>
            <th class="exa" colspan="2">Large Reads</th>
            <th class="exa" colspan="2">Large Writes</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="disk_srviorq_top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_srviorq top disks - header summary -->
  <xsl:template match="disks" mode="disk_srviorq_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average Requests:
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='iorq']/@mean" mode="number"/> IOPs,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='srrq']/@mean" mode="number"/> Small Reads,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='swrq']/@mean" mode="number"/> Small Writes,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='lrrq']/@mean" mode="number"/> Large Reads,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='lwrq']/@mean" mode="number"/> Large Writes
    </li>
  </xsl:template>

  <!-- TEMPLATE disk_srviorq top disks - by disk type -->
  <xsl:template match="disks" mode="disk_srviorq_top">
    <!-- retrieve disks in sorted order -->
    <xsl:for-each select="./disk[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="disk_srviorq_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE disk_srviorq top disks - individual rows -->
  <xsl:template match="disk" mode="disk_srviorq_top_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvIopsTopDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iorq']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iorq']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srrq']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swrq']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrrq']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwrq']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- NAME: top cells by cell server IO MB/s                     -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='cell_srviomb']" mode="top">
    <a name="CELLSRV_MBPS_CELL_TOP"/>
    <h4 class="exa">Exadata Cell Server IO MB/s Statistics - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_srviomb']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="topMessageForColor"/>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Within each disk type, the top cells by Avg IO MB/s are displayed</li>
          <li class="exa">%Total - Avg IO MB/s as a percentage of the IO MB/s for the disk type</li>
          <li class="exa">Ordered by Disk Type, IO MB/s desc</li>
          <xsl:apply-templates select="./cells" mode="cell_srviomb_top_header"/>
        </ul>
        <table class="exa" border="0" summary="This table displays top cells by cell server IO MB/s">
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="3">IO MB/s</th>
            <th class="exa" colspan="8">Average MB/s</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">% Total</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Small Reads</th>
            <th class="exa" colspan="2">Small Writes</th>
            <th class="exa" colspan="2">Large Reads</th>
            <th class="exa" colspan="2">Large Writes</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="cell_srviomb_top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_srviomb top cells - header summary -->
  <xsl:template match="cells" mode="cell_srviomb_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average MB/s:
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='iomb']/@tot" mode="avgValue"/> IO MB/s,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='srmb']/@tot" mode="avgValue"/> Small Reads,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='swmb']/@tot" mode="avgValue"/> Small Writes,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='lrmb']/@tot" mode="avgValue"/> Large Reads,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='lwmb']/@tot" mode="avgValue"/> Large Writes
    </li>
  </xsl:template>

  <!-- TEMPLATE cell_srviomb top cells - by disk type -->
  <xsl:template match="cells" mode="cell_srviomb_top">
    <!-- retrieve cells in sorted order -->
    <xsl:for-each select="./cell[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="cell_srviomb_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE cell_srviomb top cells - individual rows -->
  <xsl:template match="cell" mode="cell_srviomb_top_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvMbpsTopCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iomb']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iomb']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srmb']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swmb']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrmb']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwmb']/@tot" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- NAME: top disks by cell server io mb/s                     -->
  <!-- ========================================================== -->
  <xsl:template match="//cellstats[@type='disk_srviomb']" mode="top">
    <a name="CELLSRV_MBPS_DISK_TOP"/>
    <h4 class="exa">Exadata Cell Server IO MB/s - Top Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_srviomb']/disks">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="topMessageForColor"/>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Within each disk type, the top disks by Avg IO MB/s are displayed</li>
          <li class="exa">%Total - Avg IO MB/s as a percentage of the total IO MB/s for the disk type</li>
          <li class="exa">Ordered by Disk Type, IO MB/s desc</li>
          <xsl:apply-templates select="./disks" mode="disk_srviomb_top_header"/>
        </ul>
        <table class="exa" border="0" summary="This table displays the top disks by cell server IO MB/s">
          <tr>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <td bgColor="White"></td>
            <th class="exa" colspan="3">IO MB/s</th>
            <th class="exa" colspan="8">Average MB/s</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">%Total</th>
            <th class="exa" colspan="2">Average</th>
            <th class="exa" colspan="2">Small Reads</th>
            <th class="exa" colspan="2">Small Writes</th>
            <th class="exa" colspan="2">Large Reads</th>
            <th class="exa" colspan="2">Large Writes</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="disk_srviomb_top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_srviomb top disks - header summary -->
  <xsl:template match="disks" mode="disk_srviomb_top_header">
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average MB/s:
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='iomb']/@mean" mode="number"/> IO MB/s,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='srmb']/@mean" mode="number"/> Small Reads,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='swmb']/@mean" mode="number"/> Small Writes,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='lrmb']/@mean" mode="number"/> Large Reads,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='lwmb']/@mean" mode="number"/> Large Writes
    </li>
  </xsl:template>

  <!-- TEMPLATE disk_srviomb top disks - by disk type -->
  <xsl:template match="disks" mode="disk_srviomb_top">
    <!-- retrieve disks in sorted order -->
    <xsl:for-each select="./disk[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="disk_srviomb_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE disk_srviomb top disks - individual rows -->
  <xsl:template match="disk" mode="disk_srviomb_top_row">
    <xsl:param name="diskTypeRank"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvMbpsTopDisk,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iomb']/@pct" mode="number"/></td>
      <xsl:apply-templates select="./stat[@name='iomb']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srmb']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swmb']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrmb']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwmb']/@value" mode="outlier">
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ================================================================ -->
  <!--  NAME: top cells by cell server latency                          -->
  <!--  units are based on mean value of ap for a given disk type       -->
  <!-- ================================================================ -->
  <xsl:template match="//cellstats[@type='cell_srvlatency']" mode="top">
    <a name="CELLSRV_LATENCY_CELL_TOP"/>
    <h4 class="exa">Exadata Cell Server IO Latency - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='cell_srvlatency']/cells">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="topMessageForColor"/>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Within each disk type, the top cells by Cell Latency are displayed</li>
          <li class="exa">Ordered by Disk Type, Avg Cell Latency desc</li>
          <xsl:apply-templates select="./cells" mode="cell_srvlatency_top_header"/>
        </ul>
        <table class="exa" border="0" summary="This table displays the top cells by Cell Latency">
          <tr>
            <td bgColor="White"/>
            <td bgColor="White"/>
            <th class="exa" colspan="10">Average Times</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa" colspan="2">Cell Latency</th>
            <th class="exa" colspan="2">Small Read</th>
            <th class="exa" colspan="2">Small Write</th>
            <th class="exa" colspan="2">Large Read</th>
            <th class="exa" colspan="2">Large Write</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="cell_srvlatency_top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE cell_srvlatency top cells - header summary -->
  <xsl:template match="cells" mode="cell_srvlatency_top_header">
    <xsl:variable name="unit">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average:
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Cell Latency,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='sr']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Small Read,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='sw']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Small Write,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='lr']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Large Read,
    <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='lw']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Large Write
    </li>
  </xsl:template>

  <!-- TEMPLATE cell_srvlatency top cells - by disk type -->
  <xsl:template match="cells" mode="cell_srvlatency_top">
    <xsl:variable name="unit">
      <xsl:apply-templates select="./cell[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- retrieve cells in sorted order -->
    <xsl:for-each select="./cell[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="cell_srvlatency_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
        <xsl:with-param name="toUnit" select="$unit"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE cell_srvlatency top cells - individual rows -->
  <xsl:template match="cell" mode="cell_srvlatency_top_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="toUnit"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat($linkCellSrvLatencyTopCell,translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <xsl:apply-templates select="./stat[@name='ap']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sr']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sw']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lr']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lw']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>


  <!-- ================================================================ -->
  <!--  NAME: top disks by cell server latency                          -->
  <!-- ================================================================ -->
  <xsl:template match="//cellstats[@type='disk_srvlatency']" mode="top">
    <a name="CELLSRV_LATENCY_DISK_TOP"/>
    <h4 class="exa">Exadata Cell Server IO Latency - Top Disks</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='disk_srvlatency']/disks">
       <ul>
         <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
        <xsl:call-template name="topMessageForColor"/>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
        <li class="exa">Within each disk type, the top disks by Cell Latency are displayed</li>
        <li class="exa">Ordered by Disk Type, Avg Wait Time desc</li>
        <xsl:apply-templates select="./disks" mode="disk_srvlatency_top_header"/>
       </ul>
       <table class="exa" border="0" summary="This table displays the top disks by cell latency">
         <tr>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <td bgColor="White"/>
           <th class="exa" colspan="10">Average Times</th>
         </tr>
         <tr>
           <th class="exa">Disk Type</th>
           <th class="exa">Cell Name</th>
           <th class="exa">Disk Name</th>
           <th class="exa" colspan="2">Cell Latency</th>
           <th class="exa" colspan="2">Small Read</th>
           <th class="exa" colspan="2">Small Write</th>
           <th class="exa" colspan="2">Large Read</th>
           <th class="exa" colspan="2">Large Write</th>
         </tr>
         <xsl:apply-templates select="./disks" mode="disk_srvlatency_top"/>
       </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency top disks - header summary -->
  <xsl:template match="disks" mode="disk_srvlatency_top_header">
    <xsl:variable name="unit">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <li class="exa"><xsl:value-of select="./@disk_type"/> Average:
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Cell Latency,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='sr']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Small Read,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='sw']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Small Write,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='lr']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Large Read,
    <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='lw']/@mean" mode="formatValue">
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
      <xsl:with-param name="toUnit" select="$unit"/>
    </xsl:apply-templates> Large Write
    </li>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency top disks - by disk type -->
  <xsl:template match="disks" mode="disk_srvlatency_top">
    <!-- determine unit for st and wt -->
    <xsl:variable name="unit">
      <xsl:apply-templates select="./disk[@name=$NAME_ALL]/stat[@name='ap']/@mean" mode="getMsUnit"/>
    </xsl:variable>
    <!-- retrieve disks in sorted order -->
    <xsl:for-each select="./disk[@rank &lt;= $topN]">
      <xsl:sort select="./@rank" data-type="number"/>
      <xsl:apply-templates select="." mode="disk_srvlatency_top_row">
        <xsl:with-param name="diskTypeRank" select="../@rownum"/>
        <xsl:with-param name="toUnit" select="$unit"/>
      </xsl:apply-templates>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE disk_srvlatency top disks - individual rows -->
  <xsl:template match="disk" mode="disk_srvlatency_top_row">
    <xsl:param name="diskTypeRank"/>
    <xsl:param name="toUnit"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = 1 and $diskTypeRank != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td>
        <xsl:if test="./@rank = 1">
          <xsl:value-of select="../@disk_type"/>
        </xsl:if>
      </td>
      <td><xsl:value-of select="./@cell"/></td>
      <td class="exabr">
        <a>
          <xsl:attribute name="name">
            <xsl:value-of select="concat('CELLSRV_LATENCY_DISK_TOP_',translate(../@disk_type,'/','_'),./@name)"/>
          </xsl:attribute>
        </a>
        <xsl:value-of select="./@name"/>
      </td>
      <xsl:apply-templates select="./stat[@name='ap']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sr']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='sw']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lr']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lw']/@value" mode="outlier">
        <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        <xsl:with-param name="toUnit" select="$toUnit"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>


  <!-- template for no outlier message for outlier details -->
  <xsl:template match="outliers" mode="check_outlier_msg">
    <xsl:if test="$showFlashOutliers and ./cells and count(./cells[substring(./@disk_type,1,1) = 'F']/cell) = 0">
      <li class="exa"><b>There are no cell outliers on flash</b></li>
     </xsl:if>
     <xsl:if test="$showFlashOutliers and ./cells and count(./cells[substring(./@disk_type,1,1) = 'H']/cell) = 0">
       <li class="exa"><b>There are no cell outliers on hard disks</b></li>
     </xsl:if>
     <xsl:if test="$showFlashOutliers and ./disks and count(./disks[substring(./@disk_type,1,1) = 'F']/disk) = 0">
      <li class="exa"><b>There are no disk outliers on flash</b></li>
     </xsl:if>
     <xsl:if test="$showFlashOutliers and ./disks and count(./disks[substring(./@disk_type,1,1) = 'H']/disk) = 0">
       <li class="exa"><b>There are no disk outliers on hard disks</b></li>
     </xsl:if>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for OS outlier details - Cells                      -->
  <!--  ============================================================ -->
  <xsl:template match="//outliers[@type='cell_osstat']">
    <a name="CELL_OS_OUTLIER_DETAILS_CELL"/>
    <h4 class="exa">Exadata OS IO Statistics Details for Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="($showFlashOutliers = 1 or $showDiskOutliers = 1) and (count(//outliers[@type='cell_osstat']/cells/cell) &gt; 0)">
        <ul>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
            <xsl:with-param name="showColoringMessage" select="'Y'"/>
            <xsl:with-param name="showMaxCapacityMessage" select="'Y'"/>
               </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Maximum cell capacity for hard disks:
            IOPS: <xsl:value-of select="$cellMaxDiskIOPs"/> |
            IO MB/s: <xsl:value-of select="$cellMaxDiskMBPS"/>
          </li>
          <li class="exa">Maximum cell capacity for flash disks:
            IOPS: <xsl:value-of select="$cellMaxFlashIOPs"/> |
            IO MB/s: <xsl:value-of select="$cellMaxFlashMBPS"/> 
          </li>
          <li class="exa">Only cells with outliers in an OS IO statistic are displayed</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
      </ul>
        <table class="exa" border="0" width="600" summary="This table displays details for outlier cells based on OS IO statistics">
          <tr>
            <td></td>
            <td></td>
            <th class="exa" colspan="6">IOPs</th>
            <th class="exa" colspan="6">IO MB/s</th>
            <th class="exa" colspan="4">%Disk Utilization</th>
            <th class="exa" colspan="4">Avg Service Time</th>
            <th class="exa" colspan="4">Avg Wait Time</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa" colspan="2">Cell</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Cell</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
          </tr>
          <!-- get list of cells -->
          <xsl:apply-templates select="./cells" mode="cell_osstat_outlier_detail"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="cell_osstat_outlier_detail">
    <!-- display 'All' node -->
    <xsl:variable name="diskType" select="./@disk_type"/>
    <xsl:if test="count(./cell) &gt; 0">
      <tr>
        <xsl:attribute name="class">
          <xsl:value-of select="'exa'"/>
          <xsl:if test="./@rownum &gt; 1 and count(preceding-sibling::cells/cell) &gt; 0">
            <xsl:value-of select="' exat'"/>        
          </xsl:if>
        </xsl:attribute>
        <td><xsl:value-of select="$diskType"/></td>
        <td class="exabr"><xsl:value-of select="$NAME_ALL"/></td>
        <xsl:apply-templates select="//cellstats[@type='cell_osstat']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='iops']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_osstat']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='iops']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_osstat']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='mbps']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_osstat']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='mbps']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_osstat']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='util']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_latency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='st']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_latency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='wt']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
      </tr>
    </xsl:if>
    <xsl:apply-templates select="./cell" mode="cell_osstat_outlier_detail"/>
  </xsl:template>

  <xsl:template match="cell" mode="cell_osstat_outlier_detail">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRowOutlierDetail">
        <xsl:with-param name="diskType" select="../@disk_type"/>
      </xsl:apply-templates>
    </xsl:variable>
    <!-- note each cell will only have a single row -->
    <xsl:if test="$showRow &gt; 0">
      <tr class="exa">
        <td><xsl:value-of select="../@disk_type"/></td>
        <td class="exabr">
          <!-- drop anchor -->
          <a>
            <xsl:attribute name="name">
              <xsl:value-of select="concat($linkOsOutDetailCell,translate(../@disk_type,'/','_'),./@name)"/>
            </xsl:attribute>
          </a>
          <xsl:value-of select="./@name"/>
        </td>
        <!-- display outlier values -->
        <xsl:apply-templates select="." mode="cell_osstat_outlier_value"/>
      </tr>
    </xsl:if>
  </xsl:template>

  <!-- display outlier details - all stat values for the outlier -->
  <xsl:template match="cell" mode="cell_osstat_outlier_value">
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="cellstatType" select="../../@type"/>
    <xsl:variable name="cellName" select="./@name"/>
    <!-- display iops, mbps and util -->
    <xsl:apply-templates select="//cellstats[@type=$cellstatType]/cells[@disk_type=$diskType]/cell[@name=$cellName]" mode="osstat_get_detail"/>
    <!-- and also get latency information -->
    <!-- NOTE: we guarantee we have latency information based on query -->
    <xsl:apply-templates select="//cellstats[@type='cell_latency']/cells[@disk_type=$diskType]/cell[@name=$cellName]" mode="latency_get_detail"/>
  </xsl:template>


  <!-- TEMPLATE to retrieve OS stats for cell and disk outlier detail -->
  <xsl:template match="cell|disk" mode="osstat_get_detail">
    <xsl:variable name="linkDestination">
      <xsl:choose>
        <xsl:when test="name(.) = 'cell' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkOsIoTopCell,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:when test="name(.) = 'disk' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkOsIoTopDisk,translate(../@disk_type,'/','_'),./@name)"/>     
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$EMPTY_STRING"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:if test="name(.) = 'cell'">
      <xsl:apply-templates select="./stat[@name='iops']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='iops']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:if test="name(.) = 'cell'">
      <xsl:apply-templates select="./stat[@name='mbps']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='mbps']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='util']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
  </xsl:template>

  <!-- TEMPLATE to retrieve OS latency for cell and disk outlier detail -->
  <xsl:template match="cell|disk" mode="latency_get_detail">
    <xsl:variable name="linkDestination">
      <xsl:choose>
        <xsl:when test="name(.) = 'cell' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkOsLatencyTopCell,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:when test="name(.) = 'disk' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkOsLatencyTopDisk,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$EMPTY_STRING"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!-- TODO: do we need unit of mean value for 'All' node here? -->
    <xsl:apply-templates select="./stat[@name='st']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='wt']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
  </xsl:template>



  <!--  ============================================================ -->
  <!--  TEMPLATE for OS outlier details - Disks                      -->
  <!--  ============================================================ -->
  <xsl:template match="//outliers[@type='disk_osstat']">
    <a name="CELL_OS_OUTLIER_DETAILS_Disk"/>
    <h4 class="exa">Exadata OS IO Statistics Details for Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="($showFlashOutliers = 1 or $showDiskOutliers = 1) and (count(//outliers[@type='disk_osstat']/disks/disk) &gt; 0)">
        <ul>
          <li class="exa"><xsl:value-of select="$osCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
          <xsl:with-param name="entityType" select="'disks'"/>
          <xsl:with-param name="showMaxCapacityMessage" select="'Yy'"/>
         </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Only disks with outliers in an OS IO statistic are displayed</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
       </ul>
        <table class="exa" border="0" width="600" summary="This table displays details for outlier disks based on OS IO statistics">
          <tr>
            <td></td><td></td><td></td>
            <th class="exa" colspan="4">IOPs</th>
            <th class="exa" colspan="4">IO MB/s</th>
            <th class="exa" colspan="4">% Disk Utilization</th>
            <th class="exa" colspan="4">Avg Service Time</th>
            <th class="exa" colspan="4">Avg Wait Time</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Disk Name</th>
            <th class="exa">Cell Name</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Mean</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
          </tr>
          <!-- get list of disks -->
          <xsl:apply-templates select="./disks" mode="disk_osstat_outlier_detail"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disks" mode="disk_osstat_outlier_detail">
    <!-- display All node -->
    <xsl:if test="count(./disk) &gt; 0">
      <xsl:variable name="diskType" select="./@disk_type"/>
      <tr>
        <xsl:attribute name="class">
          <xsl:value-of select="'exa'"/>
          <!-- only put a border if this is the first one with outliers -->
          <xsl:if test="./@rownum &gt; 1 and count(preceding-sibling::disks/disk) &gt; 0">
            <xsl:value-of select="' exat'"/>        
          </xsl:if>
        </xsl:attribute>
        <td><xsl:value-of select="$diskType"/></td>
        <td><xsl:value-of select="$NAME_ALL"/></td>
        <td class="exabr"><xsl:value-of select="$NAME_ALL"/></td>
        <xsl:apply-templates select="//cellstats[@type='disk_osstat']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='iops']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_osstat']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='mbps']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_osstat']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='util']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_latency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='st']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='disk_latency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='wt']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
      </tr>
      <!-- now display the individual outliers  -->
      <xsl:apply-templates select="./disk" mode="disk_osstat_outlier_detail"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="disk" mode="disk_osstat_outlier_detail">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRowOutlierDetail">
        <xsl:with-param name="diskType" select="../@disk_type"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:if test="$showRow &gt; 0">
      <tr class="exa">
        <td><xsl:value-of select="../@disk_type"/></td>
        <td>
          <!-- drop an anchor -->
          <a>
            <xsl:attribute name="name">
              <xsl:value-of select="concat($linkOsOutDetailDisk,translate(../@disk_type,'/','_'),./@name)"/>
            </xsl:attribute>
          </a>
          <xsl:value-of select="./@name"/>
        </td>
        <td class="exabr"><xsl:value-of select="./@cell"/></td>
        <!-- display outlier values -->
        <xsl:apply-templates select="." mode="disk_osstat_outlier_value"/>
      </tr>
    </xsl:if>
  </xsl:template>

  <!-- display individual disk outliers -->
  <xsl:template match="disk" mode="disk_osstat_outlier_value">
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="cellstatType" select="../../@type"/>
    <xsl:variable name="diskName" select="./@name"/>
    <xsl:apply-templates select="//cellstats[@type=$cellstatType]/disks[@disk_type=$diskType]/disk[@name=$diskName]" mode="osstat_get_detail"/>
    <xsl:apply-templates select="//cellstats[@type='disk_latency']/disks[@disk_type=$diskType]/disk[@name=$diskName]" mode="latency_get_detail"/>
  </xsl:template>


  <!--  ============================================================ -->
  <!--  TEMPLATE for cell server outlier details - Cells             -->
  <!--  ============================================================ -->
  <xsl:template match="//outliers[@type='cell_srvstat']">
    <a name="CELLSRV_OUTLIER_DETAILS_CELL"/>
    <h4 class="exa">Exadata Cell Server Details for Outlier Cells</h4>
    <xsl:choose>
      <xsl:when test="($showFlashOutliers = 1 or $showDiskOutliers = 1) and (count(//outliers[@type='cell_srvstat']/cells/cell) &gt; 0)">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'cells'"/>
           <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Only cells with outliers in a cell server statistic are displayed</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays details for outlier cells based on cell server statistics">
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td><td></td><td></td><td></td><td></td>
            <td></td><td></td><td></td><td></td><td></td>
            <th class="exa" colspan="20">per Disk</th>
          </tr>
          <tr>
            <td></td><td></td>
            <td></td>
            <th class="exa" colspan="10">per Cell</th>
            <th class="exa" colspan="4">Total I/O</th>
            <th class="exa" colspan="4">Small Read</th>
            <th class="exa" colspan="4">Small Write</th>
            <th class="exa" colspan="4">Large Read</th>
            <th class="exa" colspan="4">Large Write</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Statistic</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="2">Small Read</th>
            <th class="exa" colspan="2">Small Write</th>
            <th class="exa" colspan="2">Large Read</th>
            <th class="exa" colspan="2">Large Write</th>
            <th class="exa" colspan="2">Value</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Value</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Value</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Value</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">Value</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
          </tr>
          <!-- get list of cells -->
          <xsl:apply-templates select="./cells" mode="cell_srvstat_outlier_detail"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="cell_srvstat_outlier_detail">
    <xsl:if test="count(./cell) &gt; 0">
      <xsl:variable name="diskType" select="./@disk_type"/>
      <tr>
        <xsl:attribute name="class">
          <xsl:value-of select="'exa'"/>
          <xsl:if test="./@rownum &gt; 1 and count(preceding-sibling::cells/cell) &gt; 0">
            <xsl:value-of select="' exat'"/>
          </xsl:if>
        </xsl:attribute>
        <td><xsl:value-of select="$diskType"/></td>
        <td class="exabr"><xsl:value-of select="$NAME_ALL"/></td>
        <td nowrap="true">Cell Server IOPs</td>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='iorq']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='srrq']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='swrq']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lrrq']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lwrq']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="'exabr'"/>
        </xsl:apply-templates>
        <!-- now get per disk -->
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='iorq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='srrq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='swrq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lrrq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lwrq']" mode="allMean"/>
      </tr>
      <tr class="exa">
        <td></td><td class="exabr"></td>
        <td nowrap="true">Cell Server IO MB/s</td>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='iomb']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='srmb']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='swmb']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lrmb']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="''"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lwmb']/@tot" mode="getAvg">
          <xsl:with-param name="class" select="'exabr'"/>
        </xsl:apply-templates>
        <!-- now get per disk -->
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='iomb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='srmb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='swmb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lrmb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lwmb']" mode="allMean"/>
      </tr>
      <tr class="exa">
        <td></td><td class="exabr"></td>
        <td nowrap="true">Cell Server IO Latency</td>
        <td></td><td></td>
        <td></td><td></td>
        <td></td><td></td>
        <td></td><td></td>
        <td></td><td class="exabr"></td>
        <!-- now get per disk -->
        <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='ap']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='sr']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='sw']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lr']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lw']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
      </tr>
      <xsl:apply-templates select="./cell" mode="cell_srvstat_outlier_detail"/>    </xsl:if>
  </xsl:template>

  <xsl:template match="cell" mode="cell_srvstat_outlier_detail">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRowOutlierDetail">
        <xsl:with-param name="diskType" select="../@disk_type"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="cellName" select="./@name"/>
    <xsl:if test="$showRow &gt; 0">
      <!-- note we will have 3 rows - reqs, mbps, and latency -->
      <tr class="exa">
        <td><xsl:value-of select="../@disk_type"/></td>
        <td class="exabr">
          <!-- drop an anchor -->
          <a>
            <xsl:attribute name="name">
              <xsl:value-of select="concat($linkCellSrvOutDetailCell,translate(../@disk_type,'/','_'),./@name)"/>
            </xsl:attribute>
          </a>
          <xsl:value-of select="./@name"/>
        </td>
        <xsl:apply-templates select="//cellstats[@type='cell_srviorq']/cells[@disk_type=$diskType]/cell[@name=$cellName]" mode="srviorq_get_detail"/>
      </tr>
      <tr class="exa">
        <td></td><td class="exabr"></td>
        <xsl:apply-templates select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$cellName]" mode="srviomb_get_detail"/>
      </tr>
      <tr class="exa">
        <td></td><td class="exabr"></td>
        <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell[@name=$cellName]" mode="srvlatency_get_detail"/>
      </tr>
    </xsl:if>
  </xsl:template>

  <xsl:template match="cell|disk" mode="srviorq_get_detail">
    <xsl:variable name="linkDestination">
      <xsl:choose>
        <xsl:when test="name(.) = 'cell' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkCellSrvIopsTopCell,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:when test="name(.) = 'disk' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkCellSrvIopsTopDisk,translate(../@disk_type,'/','_'),./@name)"/>          
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$EMPTY_STRING"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <td nowrap="true">Cell Server IOPs</td>
    <xsl:if test="name(.) = 'cell'">
      <xsl:apply-templates select="./stat[@name='iorq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwrq']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </xsl:if>
    <!-- per disk values -->
    <xsl:apply-templates select="./stat[@name='iorq']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='srrq']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='swrq']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='lrrq']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='lwrq']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
  </xsl:template>

  <xsl:template match="cell|disk" mode="srviomb_get_detail">
    <xsl:variable name="linkDestination">
      <xsl:choose>
        <xsl:when test="name(.) = 'cell' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkCellSrvMbpsTopCell,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:when test="name(.) = 'disk' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkCellSrvMbpsTopDisk,translate(../@disk_type,'/','_'),./@name)"/>          
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$EMPTY_STRING"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <td nowrap="true">Cell Server IO MB/s</td>
    <xsl:if test="name(.) = 'cell'">
      <xsl:apply-templates select="./stat[@name='iomb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='srmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='swmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lrmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='lwmb']/@tot" mode="outlier">
        <xsl:with-param name="linkDestination" select="$linkDestination"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </xsl:if>
    <!-- per disk values -->
    <xsl:apply-templates select="./stat[@name='iomb']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='srmb']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='swmb']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='lrmb']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='lwmb']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
  </xsl:template>

  <xsl:template match="cell|disk" mode="srvlatency_get_detail">
    <xsl:variable name="linkDestination">
      <xsl:choose>
        <xsl:when test="name(.) = 'cell' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkCellSrvLatencyTopCell,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:when test="name(.) = 'disk' and ./@rank &lt;= $topN">
          <xsl:value-of select="concat('#',$linkCellSrvLatencyTopDisk,translate(../@disk_type,'/','_'),./@name)"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$EMPTY_STRING"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <td nowrap="true">Cell Server IO Latency</td>
    <xsl:if test="name(.) = 'cell'">
      <td></td><td></td>
      <td></td><td></td>
      <td></td><td></td>
      <td></td><td></td>
      <td></td><td class="exabr"></td>      
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='ap']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='sr']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='sw']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='lr']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
    <xsl:apply-templates select="./stat[@name='lw']/@value" mode="outlier">
      <xsl:with-param name="linkDestination" select="$linkDestination"/>
      <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
    </xsl:apply-templates>
    <td></td><td class="exabr"></td>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for cell server outlier details - Disks             -->
  <!--  ============================================================ -->
  <xsl:template match="//outliers[@type='disk_srvstat']">
    <a name="CELLSRV_OUTLIER_DETAILS_DISK"/>
    <h4 class="exa">Exadata Cell Server Details for Outlier Disks</h4>
    <xsl:choose>
      <xsl:when test="($showFlashOutliers = 1 or $showDiskOutliers = 1) and (count(//outliers[@type='disk_srvstat']/disks/disk) &gt; 0)">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <xsl:call-template name="outlierMessage">
            <xsl:with-param name="entityType" select="'disks'"/>
            <xsl:with-param name="cellServer" select="'Y'"/>
          </xsl:call-template>
          <li class="exa"><xsl:value-of select="$diskTypeMessage"/></li>
          <li class="exa">Only disks with outliers in a cell server statistic are displayed</li>
          <xsl:apply-templates select="." mode="check_outlier_msg"/>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays details for outlier disks based on cell server statistics">
          <tr>
            <td></td><td></td><td></td><td></td>
            <th class="exa" colspan="4">I/O</th>
            <th class="exa" colspan="4">Small Read</th>
            <th class="exa" colspan="4">Small Write</th>
            <th class="exa" colspan="4">Large Read</th>
            <th class="exa" colspan="4">Large Write</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Disk Name</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Statistic</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
            <th class="exa" colspan="2">per Disk</th>
            <th class="exa">Std Dev</th>
            <th class="exa">Range</th>
          </tr>
          <!-- get list of disks -->
          <xsl:apply-templates select="./disks" mode="disk_srvstat_outlier_detail"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disks" mode="disk_srvstat_outlier_detail">
    <xsl:if test="count(./disk) &gt; 0">
      <!-- display 'All' node -->
      <xsl:variable name="diskType">
        <xsl:value-of select="./@disk_type"/>
      </xsl:variable>
      <tr>
        <xsl:attribute name="class">
          <xsl:value-of select="'exa'"/>
          <xsl:if test="./@rownum &gt; 1 and count(preceding-sibling::disks/disk) &gt; 0">
            <xsl:value-of select="' exat'"/>
          </xsl:if>
        </xsl:attribute>
        <td><xsl:value-of select="$diskType"/></td>
        <td><xsl:value-of select="$NAME_ALL"/></td>
        <td class="exabr"><xsl:value-of select="$NAME_ALL"/></td>
        <td>Cell Server IOPs</td>
        <xsl:apply-templates select="//cellstats[@type='disk_srviorq']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='iorq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviorq']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='srrq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviorq']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='swrq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviorq']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='lrrq']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviorq']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='lwrq']" mode="allMean"/>
      </tr>
      <tr class="exa">
        <td></td><td></td><td class="exabr"></td>
        <td>Cell Server IO MB/s</td>
        <xsl:apply-templates select="//cellstats[@type='disk_srviomb']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='iomb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviomb']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='srmb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviomb']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='swmb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviomb']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='lrmb']" mode="allMean"/>
        <xsl:apply-templates select="//cellstats[@type='disk_srviomb']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='lwmb']" mode="allMean"/>
      </tr>
      <tr class="exa">
        <td></td><td></td><td class="exabr"></td>
        <td>Cell Server IO Latency</td>
        <xsl:apply-templates select="//cellstats[@type='disk_srvlatency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='ap']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='disk_srvlatency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='sr']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='disk_srvlatency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='sw']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='disk_srvlatency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='lr']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
        <xsl:apply-templates select="//cellstats[@type='disk_srvlatency']/disks[@disk_type=$diskType]/disk[@name=$NAME_ALL]/stat[@name='lw']" mode="allMean">
          <xsl:with-param name="statUnit" select="$UNIT_SEC"/>
        </xsl:apply-templates>
      </tr>
      <xsl:apply-templates select="./disk" mode="disk_srvstat_outlier_detail"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="disk" mode="disk_srvstat_outlier_detail">
    <xsl:variable name="showRow">
      <xsl:apply-templates select="." mode="showRowOutlierDetail">
        <xsl:with-param name="diskType" select="../@disk_type"/>
      </xsl:apply-templates>
    </xsl:variable>
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="cellName" select="./@cell"/>
    <xsl:variable name="diskName" select="./@name"/>
    <xsl:if test="$showRow &gt; 0">
      <tr class="exa">
        <td><xsl:value-of select="$diskType"/></td>
        <td>
          <!-- drop anchor -->
          <a>
            <xsl:attribute name="name">
              <xsl:value-of select="concat($linkCellSrvOutDetailDisk,translate($diskType,'/','_'),$diskName)"/>
            </xsl:attribute>
          </a>
          <xsl:value-of select="$diskName"/>
        </td>
        <td class="exabr"><xsl:value-of select="$cellName"/></td>
        <xsl:apply-templates select="//cellstats[@type='disk_srviorq']/disks[@disk_type=$diskType]/disk[@name=$diskName]" mode="srviorq_get_detail"/>
      </tr>
      <tr class="exa">
        <td></td><td></td><td class="exabr"></td>
        <xsl:apply-templates select="//cellstats[@type='disk_srviomb']/disks[@disk_type=$diskType]/disk[@name=$diskName]" mode="srviomb_get_detail"/>
      </tr>
      <tr class="exa">
        <td></td><td></td><td class="exabr"></td>
        <xsl:apply-templates select="//cellstats[@type='disk_srvlatency']/disks[@disk_type=$diskType]/disk[@name=$diskName]" mode="srvlatency_get_detail"/>
      </tr>
    </xsl:if>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for smart io                                        -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='smart_io']">
    <a name="CELL_SMART_IO"/>
    <h4 class="exa">Smart IO</h4>
    <xsl:if test="not(./cells)">
      <p><xsl:value-of select="$noDataMsg"/></p>
    </xsl:if>
    <xsl:apply-templates select="cells" mode="smart_io"/>
  </xsl:template>

  <xsl:template match="cells" mode="smart_io">
    <ul>
      <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
      <li class="exa">Storage Index - bytes saved by storage index and percentage of requested bytes saved by storage index</li>
      <li class="exa">Flash Cache - bytes read from flash cache and percentage of requested bytes read from flash cache</li>
      <li class="exa">Offload - bytes processed by the cells and not returned to the database</li>
      <li class="exa">Passthru - bytes returned as-is to the database (for reasons other than high cell cpu) and percentage of requested bytes returned as-is to the database</li>
      <li class="exa">Reverse Offload - bytes returned as-is to the database due to high cell cpu and percentage of requested bytes returned as-is to the database</li>
      <li class="exa">Ordered by Total MB Requested desc</li>
    </ul>
    
    <table class="exa" border="0" width="600" summary="This table displays Smart I/O statistics">
      <tr>
        <td></td>
        <th class="exa" colspan="3">MB Requested</th>
        <th class="exa" colspan="2">Storage Index</th>
        <th class="exa" colspan="2">Flash Cache</th>
        <th class="exa" colspan="2">Offload</th>
        <th class="exa" colspan="2">Passthru</th>
        <th class="exa" colspan="2">Reverse Offload</th>
      </tr>
      <tr class="exa">
        <th class="exa">Cell Name</th>
        <th class="exa">% Total</th>
        <th class="exa">Total</th>
        <th class="exa">per Sec</th>
        <th class="exa">MB</th>
        <th class="exa">% Optimized</th>
        <th class="exa">MB</th>
        <th class="exa">% Optimized</th>
        <th class="exa">MB</th>
        <th class="exa">% Efficiency</th>
        <th class="exa">MB</th>
        <th class="exa">% Passthru</th>
        <th class="exa">MB</th>
        <th class="exa">% ReverseOffload</th>
      </tr>
      <xsl:apply-templates select="cell" mode="smart_io"/>
    </table>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- smart_io individual rows                                     -->
  <xsl:template match="cell" mode="smart_io">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      
      <!--  for total MB, also display %Total for the cells -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='smiot']/@pct" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='smiot']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='smiot']/@psec" mode="number"/>
      </td>
      
      <!--  totals -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='stind']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='stind']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='smiofc']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='smiofc']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='smiofl']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='smiofl']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='smiopt']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='smiopt']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='smiopdb']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='smiopdb']/@ratio" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for passthru                                        -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='passthru']">
    <a name="CELL_PASSTHRU"/>
    <h4 class="exa">Passthru Reasons</h4>
    <ul>
      <li class="exa">These statistics are for this database, and not restiricted to an instance</li>
      <li class="exa">Ordered by Number of Sessions desc</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays passthru reasons for the database">
      <tr class="exa">
        <th class="exa">Passthru Reasons</th>
        <th class="exa">Number of Sessions</th>
        <th class="exa">% Total</th>
      </tr>
      <xsl:apply-templates select="./stat" mode="passthru"/>
    </table>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for passthru - individual rows                      -->
  <!-- ============================================================ -->
  <xsl:template match="stat" mode="passthru">
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right">
        <xsl:apply-templates select="./@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@pct" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for offload writes                                  -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='offload_write']">
    <a name="CELL_OFFLOAD_WRITES"/>
    <h4 class="exa">Write Offload</h4>
    <ul>
      <li class="exa">These statistics are for this database, and not restricted to an instance</li>
      <li class="exa">Database Write Requests/s Eligible - write IOs requested by the database eligible for offload</li>
      <li class="exa">Database Write Requests/s Offloaded - write IOs offloaded to the cells</li>
      <li class="exa">Physical Write MB/s Local HCA - write MB/s sent on the local HCA to the cells during offload</li>
      <li class="exa">Physical Write MB/s Cell-to-Cell - write MB/s sent cell-to-cell</li>
      <xsl:if test="not(./inst/stat[@name='lwrite']/@elig)">
        <li class="exa"><b>There are no writes eligible for offload</b></li>
      </xsl:if>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays write offload information">
      <tr>
        <td></td>
        <td></td>
        <th class="exa" colspan="2">%Utilization</th>
        <th class="exa" colspan="2">Database Write Requests/s</th>
        <th class="exa" colspan="2">Physical Write MB/s</th>
        <th class="exa" colspan="3">Infiniband HCA MB/s</th>
      </tr>
      <tr>
        <th class="exa">Inst#</th>
        <th class="exa">%Efficiency</th>
        <th class="exa">Transmit</th>
        <th class="exa">Receive</th>
        <th class="exa">Eligible</th>
        <th class="exa">Offloaded</th>
        <th class="exa">Local HCA</th>
        <th class="exa">Cell-to-Cell</th>
        <th class="exa">Max</th>
        <th class="exa">Transmit</th>
        <th class="exa">Receive</th>
      </tr>
      <xsl:apply-templates select="./inst" mode="offload_write"/>
    </table>
  </xsl:template>

  <xsl:template match="inst" mode="offload_write">
    <tr class="exa">
      <td align="right"><xsl:value-of select="./@id"/></td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='eff']/@value" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='load_avg']/@xmit" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='load_avg']/@recv" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='lwrite']/@elig" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='lwrite']/@value" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='pwrite']/@value" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='pwrite']/@c2c" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='hca']/@max_rate" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='hca']/@xmit" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='hca']/@recv" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash log                                       -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='flash_log']">
    <a name="CELL_FLASH_LOG"/>
    <h4 class="exa">Flash Log</h4>
    <xsl:if test="not(./cells)">
      <p><xsl:value-of select="$noDataMsg"/></p>
    </xsl:if>
    <xsl:apply-templates select="./cells" mode="flash_log"/>
  </xsl:template>

  <xsl:template match="cells" mode="flash_log">
    <ul>
      <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
      <li class="exa">Writes - writes serviced by flash log</li>
      <li class="exa">First Writes Flash Log - writes written first to smart flash log</li>
      <li class="exa">First Writes DB Log - writes written first to database redo log file</li>
      <li class="exa">% Efficiency - percentage when flash log prevented writes from exceeding the threshold</li>
      <li class="exa">Prevented - flash log writes prevented from exceeding outlier threshold</li>
      <li class="exa">Actual - flash log writes that exceeded outlier threshold</li>      
      <li class="exa">Disk I/O Errors - disk I/O errors encountered by flash log (should be 0)</li>
      <li class="exa">Flash I/O Errors - flash I/O errors encountered by flash log (should be 0)</li>
      <li class="exa">Keep - redo saved on flash due to disk I/O errors (should be 0)</li>
      <li class="exa">Skip Count - redo writes not serviced by flash log (should be 0)</li>
      <li class="exa">Ordered by Total Write Requests desc</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays Flash Log statistics">
      
      <tr>
        <td></td>
        <th class="exa" colspan="3">Write Requests</th>
        <th class="exa" colspan="2">Write MB</th>
        <th class="exa" colspan="3">First Writes</th>
        <th class="exa" colspan="3">Outliers</th>
        <th class="exa" colspan="2">Errors</th>
      </tr>
      <tr class="exa">
        <th class="exa">Cell Name</th>
        <th class="exa">% Total</th>
        <th class="exa">Total</th>
        <th class="exa">per Sec</th>
        <th class="exa">Total</th>
        <th class="exa">per Sec</th>
        <th class="exa">%Flash Log</th>
        <th class="exa">Flash Log</th>
        <th class="exa">DB Log</th>
        <th class="exa">% Efficiency</th>
        <th class="exa">Prevented</th>
        <th class="exa">Actual</th>
        <th class="exa">Disk I/O</th>
        <th class="exa">Flash I/O</th>
        <th class="exa">Keep (MB)</th>
        <th class="exa">Skip Count</th>
      </tr>
      <xsl:apply-templates select="./cell" mode="flash_log"/>
    </table>
  </xsl:template>

  
  <!--  ============================================================ -->
  <!--  TEMPLATE for flash log - individual rows                     -->
  <!--  ============================================================ -->
  <xsl:template match="cell" mode="flash_log">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
          <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <!--  for Total Writes, display %Total for individual cells -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='flrwsvc']/@pct" mode="number"/>
      </td>
      <!--  Flash Log Redo Writes SerViCed -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='flrwsvc']/@value" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='flrwsvc']/@psec" mode="number"/>
      </td>
      <!--  Flash Log Redo Write Bytes SerViCed -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='flrwbsvc']/@value" mode="number"/> 
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='flrwbsvc']/@psec" mode="number"/>
      </td>

      <!-- Flash Log Redo Bytes - pending -->
      <!-- Flash Write First % -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='flwffp']/@value" mode="number"/>
      </td>
      <!-- Flash first -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='flwff']/@value" mode="int"/>
      </td>
      <!-- disk first -->
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='flwfd']/@value" mode="int"/>
      </td>

      <!--  Flash Log EFFiciency -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fleff']/@value" mode="number"/>
      </td>
      <!--  Flash Log Disk Writes Saved OUTlier -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fldwsout']/@value" mode="int"/>
      </td>
      <!--  Flash Log Redo Write OUTlier -->
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='flrwout']/@value" mode="int"/>
      </td>   
      <!--  Flash Log Disk Write ERRor -->   
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fldwerr']/@value" mode="int"/>
      </td>
      <!--  Flash Log Write ERRor -->
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='flwerr']/@value" mode="int"/>
      </td>
      <!--  Flash Log Redo Bytes SAVed -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='flrbsav']/@value" mode="number"/>
      </td>
      <!--  Flash Log Redo Writes SKiPped -->
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='flrwskp']/@value" mode="int"/>
      </td>
      
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for flash log skip details                          -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='flskip']">
    <a name="CELL_FLASH_LOG_SKIP"/>
    <h4 class="exa">Flash Log Skip Details</h4>
    <xsl:if test="not(./cells)">
      <p><xsl:value-of select="$noDataMsg"/></p>
    </xsl:if>
    <xsl:apply-templates select="./cells" mode="flskip"/>
  </xsl:template>

  <xsl:template match="cells" mode="flskip">
    <ul>
      <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
      <li class="exa">The top cells by Total Skip Count are displayed</li>
      <li class="exa">Outliers - # of outliers when redo log write skips use of Flash Log </li>
      <li class="exa">The Flash Log write may be skipped due to the following reasons:</li>
      <li class="exa">Busy - data pending to be written to disk</li>
      <li class="exa">Large Data - size of data larger than available space</li>
      <li class="exa">No Buffer - Flash Log buffer allocation failure</li>
      <li class="exa">On Flash - redo log resides on flash disk</li>
      <li class="exa">No FL Disk - no active Flash Log disks</li>
      <li class="exa">Disabled Grid Disk - flash log disabled for underlying grid disk (due to recent write errors)</li>
      <li class="exa">IORM Plan - disabled by IORM plan</li>
      <li class="exa">IORM Limit - IORM limit reached for disk containing redo log</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays Flash Log Skip Details">
      <tr>
        <td></td>
        <th class="exa" colspan="2">Skip Count</th>
      </tr>
      <tr>
        <th class="exa">Cell Name</th>
        <th class="exa">% Total</th>
        <th class="exa">Total</th>
        <th class="exa">Outliers</th>
        <th class="exa">Busy</th>
        <th class="exa">Large Data</th>
        <th class="exa">No Buffer</th>
        <th class="exa">On Flash</th>
        <th class="exa">No FL Disks</th>
        <th class="exa">Disabled Grid Disk</th>
        <th class="exa">IORM Plan</th>
        <th class="exa">IORM Limit</th>
      </tr>
      <xsl:apply-templates select="./cell" mode="flskip"/>
    </table>
  </xsl:template>

  <xsl:template match="cell" mode="flskip">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (', ./@num_cells, ')')"/>
      </xsl:if>
      </td>
      <xsl:choose>
        <xsl:when test="./@name = $NAME_ALL">
          <td></td>
        </xsl:when>
        <xsl:otherwise>
          <td align="right">
            <xsl:apply-templates select="./stat[@name='sktot']/@pct" mode="number"/>
          </td>
        </xsl:otherwise>
      </xsl:choose>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='sktot']/@value" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='skout']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skbusy']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skszlg']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skbffl']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skrlfl']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='sknofd']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skfldis']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skiormpl']/@value" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='skiormlt']/@value" mode="int"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Redo Write Histogram                            -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='flhist']">
    <a name="CELL_FLASH_LOG_HISTOGRAM"/>
    <h4 class="exa">Redo Write Histogram</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='flhist']/histogram">
        <ul>
          <li class="exa">log file parallel write is for the entire database, not restricted to an instance</li>
          <li class="exa">Redo log write completions are collected by the cells</li>
          <li class="exa">Cells for redo log write completions are ordered by # of writes >= 512ms</li>
          <li class="exa">Redo log write completion Avg Wait is the average time for the redo log write request, including network overhead</li>
          <li class="exa">Redo log write completion Average IO Time is the average time for the IO request</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary single block reads">
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <th class="exa" colspan="22">% of Total</th>
          </tr>
          <tr>
            <td></td>
            <th class="exa">Cell Name</th>
            <th class="exa">Total Waits</th>
            <th class="exa">Avg Wait</th>
            <th class="exa"></th>
            <th class="exa">&lt;1us</th>
            <th class="exa">&lt;2us</th>
            <th class="exa">&lt;4us</th>
            <th class="exa">&lt;8us</th>
            <th class="exa">&lt;16us</th>
            <th class="exa">&lt;32us</th>
            <th class="exa">&lt;64us</th>
            <th class="exa">&lt;128us</th>
            <th class="exa">&lt;256us</th>
            <th class="exa">&lt;512us</th>
            <th class="exa">&lt;1ms</th>
            <th class="exa">&lt;2ms</th>
            <th class="exa">&lt;4ms</th>
            <th class="exa">&lt;8ms</th>
            <th class="exa">&lt;16ms</th>
            <th class="exa">&lt;32ms</th>
            <th class="exa">&lt;64ms</th>
            <th class="exa">&lt;128ms</th>
            <th class="exa">&lt;256ms</th>
            <th class="exa">&lt;512ms</th>
            <th class="exa">&lt;1s</th>
            <th class="exa">&gt;=1s</th>
          </tr>
          <!-- now display different histograms -->
          <xsl:apply-templates select="./histogram[@name='log file parallel write']"/>
          <xsl:if test="./histogram[@name='Redo log write completions']">
            <tr>
              <td></td>
              <th class="exa">Cell Name</th>
              <th class="exa">Total Writes</th>
              <th class="exa">Avg Wait</th>
              <th class="exa">Average IO Time</th>
              <th class="exa">&lt;1us</th>
              <th class="exa">&lt;2us</th>
              <th class="exa">&lt;4us</th>
              <th class="exa">&lt;8us</th>
              <th class="exa">&lt;16us</th>
              <th class="exa">&lt;32us</th>
              <th class="exa">&lt;64us</th>
              <th class="exa">&lt;128us</th>
              <th class="exa">&lt;256us</th>
              <th class="exa">&lt;512us</th>
              <th class="exa">&lt;1ms</th>
              <th class="exa">&lt;2ms</th>
              <th class="exa">&lt;4ms</th>
              <th class="exa">&lt;8ms</th>
              <th class="exa">&lt;16ms</th>
              <th class="exa">&lt;32ms</th>
              <th class="exa">&lt;64ms</th>
              <th class="exa">&lt;128ms</th>
              <th class="exa">&lt;256ms</th>
              <th class="exa">&lt;512ms</th>
              <th class="exa">&lt;1s</th>
              <th class="exa">&gt;=1s</th>
            </tr>
          </xsl:if>
          <xsl:apply-templates select="./histogram[@name='Redo log write completions']"/>

        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="//cellstats[@type='flhist']/histogram[@name='log file parallel write']">
    <tr class="exa">
      <td nowrap="true"><xsl:value-of select="./@name"/></td>
      <td></td>
      <td align="right">
        <xsl:apply-templates select="../waits/@wt" mode="int"/>
      </td>
      <td align="right">
        <xsl:attribute name="title">Total Time: <xsl:apply-templates select="../waits/@tm" mode="formatMs"/>
        </xsl:attribute>
        <xsl:apply-templates select="../waits/@avtm" mode="formatMs"/>
      </td>
      <td></td>
      <xsl:call-template name="histogramLoop">
        <xsl:with-param name="type" select="'flhist'"/>
        <xsl:with-param name="wait" select="./@name"/>
        <xsl:with-param name="id" select="'1'"/>
      </xsl:call-template>
    </tr>

  </xsl:template>

  <!-- template to loop through cell histogram buckets -->
  <xsl:template name="histogramCellLoop">
    <xsl:param name="type"/>
    <xsl:param name="wait"/>
    <xsl:param name="cellName"/>
    <xsl:param name="id"/>
    <xsl:if test="$id &lt;= 2097152">
      <td align="right">
        <!-- TODO: not matching attribute for number using apply-templates -->
        <xsl:apply-templates select="//cellstats[@type=$type]/histogram[@name=$wait]/cell[@name=$cellName]/bkt[@id=$id]" mode="number"/>
        <xsl:if test="//cellstats[@type=$type]/histogram[@name=$wait]/cell[@name=$cellName]/bkt[@id=$id]/@value">
          <xsl:attribute name="title">
              <xsl:value-of select="concat('Bucket: ', $id, '; # of Writes: ',//cellstats[@type=$type]/histogram[@name=$wait]/cell[@name=$cellName]/bkt[@id=$id]/@value)"/>
          </xsl:attribute>
        </xsl:if>
      </td>
      <xsl:call-template name="histogramCellLoop">
        <xsl:with-param name="type" select="$type"/>
        <xsl:with-param name="wait" select="$wait"/>
        <xsl:with-param name="cellName" select="$cellName"/>
        <xsl:with-param name="id">
          <xsl:number value="number($id * 2)"/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>


  <xsl:template match="//cellstats[@type='flhist']/histogram[@name='Redo log write completions']">
    <xsl:apply-templates select="./cell"/>
  </xsl:template>
  
  <xsl:template match="//cellstats[@type='flhist']/histogram[@name='Redo log write completions']/cell">
    <tr class="exa">
      <xsl:choose>
        <xsl:when test="./@name=$NAME_ALL">
          <td nowrap="true"><xsl:value-of select="../@name"/></td>
        </xsl:when>
        <xsl:otherwise>
          <td></td>
        </xsl:otherwise>
      </xsl:choose>
      <td>
        <xsl:apply-templates select="./@name" mode="allToTotal"/>
        <xsl:if test="./@name = $NAME_ALL">
          <xsl:value-of select="concat(' (',./@num_cells,')')"/>        
        </xsl:if>
      </td>
      <td align="right">
        <xsl:attribute name="title"><xsl:value-of select="concat('# of Waits: ', ./@twt_w)"/>
        </xsl:attribute>
        <xsl:apply-templates select="./@twt" mode="int"/>
      </td>
      <td align="right">
        <xsl:attribute name="title">Total Time: <xsl:apply-templates select="./@tmrq" mode="formatMs"/>
        </xsl:attribute>
        <xsl:apply-templates select="./@avtmrq" mode="formatMs"/>
      </td>
      <td align="right">
        <xsl:attribute name="title">Total IO Time: <xsl:apply-templates select="./@tmio" mode="formatMs"/>
        </xsl:attribute>
        <xsl:apply-templates select="./@avtmio" mode="formatMs"/>
      </td>
      <xsl:call-template name="histogramCellLoop">
        <xsl:with-param name="type" select="'flhist'"/>
        <xsl:with-param name="wait" select="../@name"/>
        <xsl:with-param name="cellName" select="./@name"/>
        <xsl:with-param name="id" select="'1'"/>
      </xsl:call-template>
    </tr>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache configuration                       -->
  <!--  ============================================================ -->
  <xsl:template match="//config[@type='fc']">
    <a name="CELL_FLASH_CACHE_CONFIG"/>
    <h4 class="exa">Flash Cache Configuration</h4>
    <ul>
      <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
    </ul>
    <table class="exa"  border="0" width="600" summary="This table displays Flash Cache Configuration">
      <tr>
        <th class="exa">Mode</th>
        <th class="exa">Compression</th>
        <th class="exa">Status</th>
        <th class="exa">Cells</th>
      </tr>
      <xsl:apply-templates select="./fc" mode="fc"/>
    </table>
  </xsl:template>

  <xsl:template match="fc" mode="fc">
    <tr class="exa">
      <td>
        <!-- put warning if we have different configs -->
        <xsl:if test="count(preceding-sibling::*) + count(following-sibling::*) &gt; 0">
          <xsl:attribute name="class">
            <xsl:value-of select="'exawarn'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="./@mode"/>
      </td>
      <td>
        <xsl:if test="count(preceding-sibling::*) + count(following-sibling::*) &gt; 0">
          <xsl:attribute name="class">
            <xsl:value-of select="'exawarn'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="./@compress"/>
      </td>
      <td nowrap="true">
        <xsl:if test="./@status and ./@status != 'normal'">
          <xsl:attribute name="class">
            <xsl:value-of select="'exawarn'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="./@status"/>
      </td>
      <td word-wrap="break-word">
      <xsl:choose>
        <xsl:when test="./cells">
          <xsl:call-template name="join">
            <xsl:with-param name="list" select="./cells/cell"/>
            <xsl:with-param name="separator" select="', '"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$NAME_ALL"/>
        </xsl:otherwise>
      </xsl:choose>
      </td>
    </tr>
  </xsl:template>
    
  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache space usage                         -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_space']">
  <a name="CELL_FLASH_CACHE_SPACE"/>
    <h4 class="exa">Flash Cache Space Usage</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Space is at the time of the end snapshot</li>
          <li class="exa">Ordered by Space (GB) desc</li>
          <xsl:if test="$showFcSpaceDetail = 'N'">
            <li class="exa">Cell Version: <xsl:value-of select="$maxCellVersion"/> does not have detailed information for space allocation</li>
          </xsl:if>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache space usage">
          <tr>
            <td/>
            <td/>
            <xsl:if test="$showFcSpaceDetail = 'Y'">
              <th class="exa" colspan="7">Default</th>
              <th class="exa" colspan="4">Keep</th>
              <!-- conditionally show other -->
              <xsl:if test="$showFcSpaceOther = 'Y'">
                <th class="exa" colspan="2">Other</th>
              </xsl:if>
            </xsl:if>
          </tr>
          <tr>
            <td/>
            <td/>
            <xsl:if test="$showFcSpaceDetail = 'Y'">
              <th class="exa" colspan="2">OLTP</th>
              <th class="exa" colspan="3">Large Writes</th>
              <th class="exa" rowspan="2">%Scan</th>
              <th class="exa" rowspan="2">%Columnar</th>
              <th class="exa" colspan="2">OLTP</th>
              <th class="exa" rowspan="2">%Scan</th>
              <th class="exa" rowspan="2">%Columnar</th>
              <xsl:if test="$showFcSpaceOther = 'Y'">
                <th class="exa" rowspan="2">%FFI</th>
                <th class="exa" rowspan="2">%FCLogger</th>
              </xsl:if>
            </xsl:if>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Space (GB)</th>
            <xsl:if test="$showFcSpaceDetail = 'Y'">
              <th class="exa">%Clean</th>
              <th class="exa">%Unflushed</th>
              <th class="exa">%Temp Spill</th>
              <th class="exa">%Data/Temp</th>
              <th class="exa">%Write Only</th>
              <th class="exa">%Clean</th>
              <th class="exa">%Unflushed</th>
            </xsl:if>
          </tr>
          <xsl:apply-templates select="./cell" mode="fc_space"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache space - individual rows             -->
  <!--  ============================================================ -->
  <xsl:template match="cell" mode="fc_space">
    <tr class="exa">
      <td>
        <!-- add coloring if lo value -->
        <xsl:if test="./@lo = 'Y'">
          <xsl:attribute name="class">
            <xsl:value-of select="'exaouth'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:apply-templates select="./@name" mode="allToTotal"/>
        <xsl:if test="./@name = $NAME_ALL">
          <xsl:value-of select="concat(' (',./@num_cells,')')"/>
        </xsl:if>
        <!-- should ideally create a link as well to the config section -->
      </td>
      <!-- convert allocated to GB -->
      <!-- keep XML as MB for backward compatibility of active report -->
      <xsl:variable name="allocGb">
        <xsl:value-of select="./stat[@name='fciou']/@alloc div 1024"/>
      </xsl:variable>
      <td align="right">
        <xsl:value-of select="format-number(./stat[@name='fciou']/@alloc div 1024,'##,###,##0.00')"/>
      </td>
      <xsl:if test="$showFcSpaceDetail = 'Y'">
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@clean" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@dirty" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@lwrow" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@lwmrw" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@lwnrw" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@dw" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@cc" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@kpoltp_clean" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@kpoltp_dirty" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@kpdw" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciop']/@kpcc" mode="number"/>
        </td>
        <xsl:if test="$showFcSpaceOther = 'Y'">
          <td align="right">
            <xsl:apply-templates select="./stat[@name='fciop']/@ffi" mode="number"/>
          </td>
          <td align="right">
            <xsl:apply-templates select="./stat[@name='fciop']/@fcl" mode="number"/>
          </td>
        </xsl:if>
      </xsl:if>
    </tr>   
  </xsl:template>
  
  <!-- ============================================================ -->
  <!-- TEMPLATE for flash cache performance summary                 -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_summary']">
    <a name="CELL_FLASH_CACHE_SUMMARY"/>
    <h4 class="exa">Performance Summary</h4>
    <!-- we construct this section by using existing xml fragments and creating
         links to the appropriate sections -->
    <xsl:call-template name="flashCacheIOSummary"/>
    <xsl:call-template name="flashCacheSavings"/>
    <xsl:call-template name="flashCacheDiskActivity"/>
    <xsl:call-template name="flashCacheSingleBlockReads"/>
    <xsl:call-template name="flashCacheDbSummary"/>
    <xsl:call-template name="flashCacheScanSummary"/>
    <xsl:if test="//cellstats[@type='fc_summary']/summary[@type='fc_temp'] or $hasFlashCacheLW = 'Y'">
      <xsl:call-template name="flashCacheTempSummary"/>
    </xsl:if>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache user reads                          -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_ureads']">
  <a name="CELL_FLASH_CACHE_UREADS"/>
    <h4 class="exa">Flash Cache User Reads</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_ureads']/cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Total - total number of reads from Flash Cache</li>
          <li class="exa">OLTP/Scan/Columnar reads include reads on keep objects</li>
          <li class="exa">Misses/Partial Hits - number of read request misses and partial hits</li>
          <li class="exa">Ordered by Total Hit Read Requests desc</li>    
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache read statistics">
          <tr>
            <td></td>
            <th class="exa" colspan="9">Read Requests</th>
            <th class="exa" colspan="8">Read Megabytes</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total Hits</th>
            <th class="exa">Hits per Sec</th>
            <th class="exa">OLTP</th>
            <th class="exa">Scan</th>
            <th class="exa">Columnar</th>
            <th class="exa">Keep</th>
            <th class="exa">Misses<br/>Partial Hits </th>
            <th class="exa">Active<br/>Secondary<br/>Hits</th>
            <th class="exa">Active<br/>Secondary<br/>Misses</th>
            <th class="exa">Total Hits</th>
            <th class="exa">Hit MB/s</th>
            <th class="exa">OLTP</th>
            <th class="exa">Scan</th>
            <th class="exa">Columnar</th>
            <th class="exa">Keep</th>
            <th class="exa">Active<br/> Secondary<br/>Hits</th>
            <th class="exa">Active<br/> Secondary<br/>Misses</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="fc_ureads"/>
        </table>

        <!-- also display per second data -->
        <p><xsl:apply-templates select="." mode="fc_ureads_psec"/></p>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="$hasEF = 'Y'">
          <p>This environment has EF cells.</p>
        </xsl:if>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache user reads - individual rows        -->
  <!--  ============================================================ -->
  <xsl:template match="cell" mode="fc_ureads">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fcior']/@rq" mode="int"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fcior']/@rqps" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fcioroltp']/@rq" mode="int"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciordw']/@rq" mode="int"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fccior']/@rq" mode="int"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fckpior']/@rq" mode="int"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciorm']/@rq" mode="int"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciorash']/@rq" mode="int"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fciorasm']/@rq" mode="int"/>
        </td>

        <td align="right">
          <xsl:apply-templates select="./stat[@name='fcior']/@mb" mode="number"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fcior']/@mbps" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fcioroltp']/@mb" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciordw']/@mb" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fccior']/@mb" mode="number"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fckpior']/@mb" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciorash']/@mb" mode="number"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fciorasm']/@mb" mode="number"/>
        </td>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for flash cache user reads per second               -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_ureads']" mode="fc_ureads_psec">
    <a name="CELL_FLASH_CACHE_UREADS_PSEC"/>
    <h4 class="exa">Flash Cache User Reads Per Second</h4>
    <ul>
      <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
      <li class="exa">Total - total number of reads per second from Flash Cache</li>
      <li class="exa">OLTP/Scan/Columnar reads include reads on keep objects</li>
      <li class="exa">Ordered by Total Hit Read Requests per Second desc</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays Flash Cache read statistics per second">
      <tr>
        <td></td>
        <th class="exa" colspan="6">Read Requests per Second</th>
        <th class="exa" colspan="5">Read MB per Second</th>
      </tr>
      <tr>
        <th class="exa">Cell Name</th>
        <th class="exa">Total Hits</th>
        <th class="exa">OLTP</th>
        <th class="exa">Scan</th>
        <th class="exa">Columnar</th>
        <th class="exa">Keep</th>
        <th class="exa">Misses</th>
        <th class="exa">Total Hits</th>
        <th class="exa">OLTP</th>
        <th class="exa">Scan</th>
        <th class="exa">Columnar</th>
        <th class="exa">Keep</th>
      </tr>
      <!-- now display data per row -->
      <xsl:apply-templates select="./cell" mode="fc_ureads_psec"/>
    </table>
  </xsl:template>


  <xsl:template match="cell" mode="fc_ureads_psec">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fcior']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcioroltp']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciordw']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fccior']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpior']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciorm']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fcior']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcioroltp']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciordw']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fccior']/@mbps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fckpior']/@mbps" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Flash Cache User Reads Efficiency               -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_ureads']" mode="efficiency">
    <a name="CELL_FLASH_CACHE_UREADS_EFF"/>
    <h4 class="exa">Flash Cache User Reads Efficiency</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Ordered by Total Hit Requests desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache user reads efficiency">
          <tr>
            <td></td>
            <th class="exa" colspan="2">Total Hits</th>
            <th class="exa" colspan="3">OLTP</th>
            <th class="exa" colspan="3">Scan</th>
            <th class="exa" colspan="4">Columnar</th>
            <th class="exa" colspan="3">Keep</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Requests</th>
            <th class="exa">MB</th>
            <th class="exa">Read Hits</th>
            <th class="exa">Misses</th>
            <th class="exa">%Hit</th>
            <th class="exa">Read MB</th>
            <th class="exa">Attempted MB</th>
            <th class="exa">%Hit</th>
            <th class="exa">Read MB</th>
            <th class="exa">Eligible MB</th>
            <th class="exa">Saved MB</th>
            <th class="exa">% Efficiency</th>
            <th class="exa">Read Hits</th>
            <th class="exa">Misses</th>
            <th class="exa">%Hit</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="efficiency"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="$hasEF = 'Y'">
          <p>This environment has EF cells.</p>
        </xsl:if>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:template match="cell" mode="efficiency">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcior']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr"> 
        <xsl:apply-templates select="./stat[@name='fcior']/@mb" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcioroltp']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcioroltp']/@misses" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fcioroltp']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciordw']/@mb" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciordw']/@att" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciordw']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fccior']/@mb" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fccior']/@elig" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fccior']/@save" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fccior']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpior']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpior']/@misses" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fckpior']/@ratio" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for columnar cache user reads                       -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='cc_ureads']">
    <a name="CELL_COLUMNAR_CACHE_UREADS_EFF"/>
    <h4 class="exa">Columnar Cache Efficiency</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">ordered by total eligible requests desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Columnar Cache user read efficiency">
          <tr>
            <td></td>
            <th class="exa" colspan="2">Eligible Requests</th>
            <th class="exa" colspan="3">IMC Capacity</th>
            <th class="exa" colspan="3">IMC Query</th>
            <th class="exa" colspan="3">No Memcompress</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Hits</th>
            <th class="exa">per Sec</th>
            <th class="exa">%Hit</th>
            <th class="exa">Hits</th>
            <th class="exa">per Sec</th>
            <th class="exa">%Hit</th>
            <th class="exa">Hits</th>
            <th class="exa">per Sec</th>
            <th class="exa">%Hit</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="cc_ureads"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="cc_ureads">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='ccelig']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='ccelig']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2ch']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2ch']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc2ch']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2qh']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2qh']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc2qh']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc1h']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc1h']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc1h']/@ratio" mode="number"/>
      </td>

    </tr>
  </xsl:template>
  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache user writes                         -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_uwrites']">
  <a name="CELL_FLASH_CACHE_UWRITES"/>
    <h4 class="exa">Flash Cache User Writes</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_uwrites']/cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Total - total  number of write requests or write megabytes to Flash Cache</li>
          <li class="exa">First Writes/Overwrites also include Keep Writes and Large Writes</li>
          <li class="exa">Ordered by Total Write Requests desc</li>
        </ul>
        <xsl:variable name="h1colspan">
          <xsl:choose>
            <xsl:when test="$showFcPartialWrites = 'Y'">
              <xsl:value-of select="12"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="10"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <xsl:variable name="h2colspan">
          <xsl:choose>
            <xsl:when test="$showFcPartialWrites = 'Y'">
              <xsl:value-of select="6"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="5"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache write statistics">
          <tr>
            <td></td>
            <th class="exa" colspan="{$h1colspan}">Write Requests</th>
            <th class="exa" colspan="{$h1colspan}">Write Megabytes</th>
          </tr>
          <tr>
            <td></td>
            <th class="exa" colspan="{$h2colspan}">Total</th>
            <th class="exa" colspan="{$h2colspan}">per Sec</th>
            <th class="exa" colspan="{$h2colspan}">Total</th>
            <th class="exa" colspan="{$h2colspan}">per Sec</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">First Writes</th>
            <th class="exa">Overwrites</th>
            <xsl:if test="$showFcPartialWrites = 'Y'">
              <th class="exa">Partial Writes</th>              
            </xsl:if>
            <th class="exa">Keep</th>
            <th class="exa">Large Writes</th>
            <th class="exa">Total</th>
            <th class="exa">First Writes</th>
            <th class="exa">Overwrites</th>
            <xsl:if test="$showFcPartialWrites = 'Y'">
              <th class="exa">Partial Writes</th>              
            </xsl:if>
            <th class="exa">Keep</th>
            <th class="exa">Large Writes</th>
            <th class="exa">Total</th>
            <th class="exa">First Writes</th>
            <th class="exa">Overwrites</th>
            <xsl:if test="$showFcPartialWrites = 'Y'">
              <th class="exa">Partial Writes</th>              
            </xsl:if>
            <th class="exa">Keep</th>
            <th class="exa">Large Writes</th>
            <th class="exa">Total</th>
            <th class="exa">First Writes</th>
            <th class="exa">Overwrites</th>
            <xsl:if test="$showFcPartialWrites = 'Y'">
              <th class="exa">Partial Writes</th>              
            </xsl:if>
            <th class="exa">Keep</th>
            <th class="exa">Large Writes</th>
          </tr>
          <xsl:apply-templates select="cell" mode="fc_uwrites"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="$hasEF = 'Y'">
          <p>This environment has EF cells.</p>
        </xsl:if>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache user writes - individual rows       -->
  <!--  ============================================================ -->
  <xsl:template match="cell" mode="fc_uwrites">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
        <xsl:if test="./@name = $NAME_ALL">
          <xsl:value-of select="concat(' (',./@num_cells,')')"/>
        </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciow']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowf']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowow']/@rq" mode="int"/>
      </td>
      <xsl:if test="$showFcPartialWrites = 'Y'">
        <td align="right">
          <xsl:if test="./stat[@name='fciowp']/@rqpct &gt; 20">
            <xsl:attribute name="class">
              <xsl:value-of select="'exaouth'"/>
            </xsl:attribute>
          </xsl:if>
          <xsl:apply-templates select="./stat[@name='fciowp']/@rq" mode="int"/>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpiow']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rq'"/>
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowf']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowow']/@rqps" mode="number"/>
      </td>
      <xsl:if test="$showFcPartialWrites = 'Y'">
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciowp']/@rqps" mode="number"/>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpiow']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rqps'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@mb" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowf']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowow']/@mb" mode="number"/>
      </td>
      <xsl:if test="$showFcPartialWrites = 'Y'">
        <td align="right">
          <xsl:if test="./stat[@name='fciowp']/@mbpct &gt; 20">
            <xsl:attribute name="class">
              <xsl:value-of select="'exaouth'"/>
            </xsl:attribute>
          </xsl:if>
          <xsl:apply-templates select="./stat[@name='fciowp']/@mb" mode="number"/>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpiow']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mb'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowf']/@mbps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowow']/@mbps" mode="number"/>
      </td>
      <xsl:if test="$showFcPartialWrites = 'Y'">
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciowp']/@mbps" mode="number"/>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fckpiow']/@mbps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mbps'"/>
        </xsl:call-template>
      </td>
    </tr>
  </xsl:template>

  <!-- get specific LW value -->
  <xsl:template name="getLWValue">
    <xsl:param name="statName"/>
    <xsl:param name="attrName"/>
    <xsl:choose>
      <!-- check stat exists -->
      <xsl:when test="./stat[@name=$statName] and ./stat[@name=$statName]/@*[local-name()=$attrName]">

        <xsl:value-of select="./stat[@name=$statName]/@*[local-name()=$attrName]"/>
      </xsl:when>
      <!-- set to 0 if it does not -->
      <xsl:otherwise>
        <xsl:value-of select="number(0)"/>          
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- compute LW sum -->
  <xsl:template name="flashCacheComputeLWSum">
    <xsl:param name="attrName"/>
    <xsl:param name="decimalPoints" select="'Y'"/>

    <!-- get individual stats, handle missing stats -->
    <xsl:variable name="fcLWROW">
      <xsl:call-template name="getLWValue">
        <xsl:with-param name="statName" select="'fclwrow'"/>
        <xsl:with-param name="attrName" select="$attrName"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="fcLWMRW">
      <xsl:call-template name="getLWValue">
        <xsl:with-param name="statName" select="'fclwmrw'"/>
        <xsl:with-param name="attrName" select="$attrName"/>
      </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="fcLWNRW">
      <xsl:call-template name="getLWValue">
        <xsl:with-param name="statName" select="'fclwnrw'"/>
        <xsl:with-param name="attrName" select="$attrName"/>
      </xsl:call-template>
    </xsl:variable>

    <xsl:call-template name="formatNumber">
      <xsl:with-param name="n" select="$fcLWROW + $fcLWMRW + $fcLWNRW"/>
      <xsl:with-param name="decimalPoints" select="$decimalPoints"/>
    </xsl:call-template>

  </xsl:template>

  <!-- TEMPLATE for flash cache user writes LW -->
  <xsl:template match="cellstats" mode="fc_uwrites_lw">
  <a name="CELL_FLASH_CACHE_UWRITES_LW"/>
    <h4 class="exa">Flash Cache User Writes - Large Writes</h4>
    <p></p>
    <ul>
      <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
      <li class="exa">Large Writes consist of Temp Spills, Writes to Data and Temp Tables, and Write Only Operations</li>
      <li class="exa">Ordered by Total Write Requests desc</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays Flash Cache write statistics for Large Writes">

      <tr>
        <td></td>
        <th class="exa" colspan="10">Write Requests</th>
        <th class="exa" colspan="10">Write Megabytes</th>
      </tr>
      <tr>
        <td></td>
        <th class="exa" colspan="5">Total</th>
        <th class="exa" colspan="5">per Sec</th>
        <th class="exa" colspan="5">Total</th>
        <th class="exa" colspan="5">per Sec</th>
      </tr>
      <tr>
        <th class="exa">Cell Name</th>
        <th class="exa">Total</th>
        <th class="exa">Large Writes</th>
        <th class="exa">Temp Spill</th>
        <th class="exa">Data/Temp Tables</th>
        <th class="exa">Write Only</th>
        <th class="exa">Total</th>
        <th class="exa">Large Writes</th>
        <th class="exa">Temp Spill</th>
        <th class="exa">Data/Temp Tables</th>
        <th class="exa">Write Only</th>
        <th class="exa">Total</th>
        <th class="exa">Large Writes</th>
        <th class="exa">Temp Spill</th>
        <th class="exa">Data/Temp Tables</th>
        <th class="exa">Write Only</th>
        <th class="exa">Total</th>
        <th class="exa">Large Writes</th>
        <th class="exa">Temp Spill</th>
        <th class="exa">Data/Temp Tables</th>
        <th class="exa">Write Only</th>
      </tr>
      <xsl:apply-templates select="cell" mode="fc_uwrites_lw"/>
    </table>
  </xsl:template>

  <xsl:template match="cell" mode="fc_uwrites_lw">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name=$NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rq'"/>
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:call-template>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwrow']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwmrw']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fclwnrw']/@rq" mode="int"/>
      </td>

      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rqps'"/>
        </xsl:call-template>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwrow']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwmrw']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fclwnrw']/@rqps" mode="number"/>
      </td>

      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mb'"/>
        </xsl:call-template>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwrow']/@mb" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwmrw']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fclwnrw']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciow']/@mbps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mbps'"/>
        </xsl:call-template>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwrow']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwmrw']/@mbps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fclwnrw']/@mbps" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <xsl:template match="cell" mode="getLWTotal">
      <xsl:call-template name="flashCacheComputeLWSum">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:call-template>
  </xsl:template>

  <xsl:template match="cell" mode="getLWTotalSummary">
    <tr class="exa">
      <td align="right">
        <a href="#CELL_FLASH_CACHE_UWRITES_LW">
          <xsl:apply-templates select="." mode="getLWTotal"/>
        </a>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwrow']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclmrw']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fclwnrw']/@rqps" mode="number"/>
      </td>
    </tr>

  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache internal reads                          -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_ireads']">
  <a name="CELL_FLASH_CACHE_IREADS"/>
    <h4 class="exa">Flash Cache Internal Reads</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_ireads']/cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Read to Disk Write - reads from flash cache to write to hard disk</li>
          <xsl:if test="$showDiskWriter = 'Y'">
            <li class="exa">Disk Writer IO Detail - actual number of IOs</li>
          </xsl:if>
          <li class="exa">Ordered by Total Read Reqs desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache read statistics">
          <xsl:if test="$showDiskWriter = 'Y'">
            <tr>
              <td></td><td></td><td></td><td></td><td></td>
              <th class="exa" colspan="4">Disk Writer IO Detail</th>
            </tr>
          </xsl:if>
          <tr>
            <td></td>
            <th class="exa" colspan="2">Read to Disk Write Reqs</th>
            <th class="exa" colspan="2">Read to Disk Write MB</th>
            <xsl:if test="$showDiskWriter = 'Y'">
              <th class="exa" colspan="2">Reads from Flash</th>
              <th class="exa" colspan="2">Writes to Hard Disk</th>
            </xsl:if>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <xsl:if test="$showDiskWriter = 'Y'">
              <th class="exa">Requests/s</th>
              <th class="exa">MB/s</th>
              <th class="exa">Requests/s</th>
              <th class="exa">MB/s</th>
            </xsl:if>
          </tr>
          <xsl:apply-templates select="cell" mode="fc_ireads"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="$hasEF = 'Y'">
          <p>This environment has EF cells.</p>
        </xsl:if>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache internal reads - individual rows    -->
  <!--  ============================================================ -->
  <xsl:template match="cell" mode="fc_ireads">

    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
        <xsl:if test="./@name = $NAME_ALL">
          <xsl:value-of select="concat(' (',./@num_cells,')')"/>
        </xsl:if>
      </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciordw']/@rq" mode="int"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fciordw']/@rqps" mode="number"/>
        </td>
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciordw']/@mb" mode="number"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fciordw']/@mbps" mode="number"/>
        </td>
        <xsl:if test="$showDiskWriter = 'Y'">
          <td align="right">
            <xsl:apply-templates select="./stat[@name='fciordkwr']/@rqps" mode="number"/>
          </td>
          <td align="right" class="exabr">
            <xsl:apply-templates select="./stat[@name='fciordkwr']/@mbps" mode="number"/>
          </td>
          <td align="right">
            <xsl:apply-templates select="./stat[@name='fciowdkwr']/@rqps" mode="number"/>
          </td>
          <td align="right" class="exabr">
            <xsl:apply-templates select="./stat[@name='fciowdkwr']/@mbps" mode="number"/>
          </td>
        </xsl:if>
    </tr>
  </xsl:template>
  
  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache internal writes                     -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='fc_iwrites']">
  <a name="CELL_FLASH_CACHE_IWRITES"/>
    <h4 class="exa">Flash Cache Internal Writes</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fc_iwrites']/cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">The top cells by Total Write Requests are displayed</li>
          <li class="exa">Population Write - population writes due to read misses</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache write statistics">
          <tr>
            <td></td>
            <th class="exa" colspan="4">Population Write Requests</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa" colspan="2">Trim</th>
            </xsl:if>
            <th class="exa" colspan="4">Population Write Megabytes</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa" colspan="2">Trim</th>
            </xsl:if>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Columnar</th>
            <th class="exa">Keep</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa">Total</th>
              <th class="exa">per Sec</th>
            </xsl:if>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Columnar</th>
            <th class="exa">Keep</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa">Total</th>
              <th class="exa">per Sec</th>
            </xsl:if>
          </tr>
          <xsl:apply-templates select="cell" mode="fc_iwrites"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="$hasEF = 'Y'">
          <p>This environment has EF cells.</p>
        </xsl:if>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache internal writes - individual rows   -->
  <!--  ============================================================ -->
  <xsl:template match="cell"  mode="fc_iwrites">

    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowpop']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowpop']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcciowpop']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fckpiowpop']/@rq" mode="int"/>
      </td>
      <xsl:if test="$showFcTrims = 'Y'">
        <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowtrim']/@rq" mode="int"/>
        </td>
        <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowtrim']/@rqps" mode="number"/>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fciowpop']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fciowpop']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcciowpop']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='fckpiowpop']/@mb" mode="number"/>
      </td>
      <xsl:if test="$showFcTrims = 'Y'">
        <td align="right">
          <xsl:apply-templates select="./stat[@name='fciowtrim']/@mb" mode="number"/>
        </td>
        <td align="right" class="exabr">
          <xsl:apply-templates select="./stat[@name='fciowtrim']/@mbps" mode="number"/>
        </td>
      </xsl:if>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for CC population                                   -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='cc_iwrites']" mode="cc_iwrites_delta">
    <a name="CELL_COLUMNAR_CACHE_IWRITES"/>
    <h4 class="exa">Columnar Cache Population</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">ordered by Population write requests desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Columnar Cacheh population information">
          <tr>
            <td></td>
            <th class="exa" colspan="4">Population Writes</th>
            <th class="exa" colspan="6">Rewrite Requests</th>
            <th class="exa" colspan="6">Rewrite Megabytes</th>
            <th class="exa" colspan="4">Evictions</th>
          </tr>
          <tr>
            <td></td>
            <th class="exa" colspan="2">Requests</th>
            <th class="exa" colspan="2">Megabytes</th>
            <th class="exa" colspan="2">IMC Capacity</th>
            <th class="exa" colspan="2">IMC Query</th>
            <th class="exa" colspan="2">No Memcompress</th>
            <th class="exa" colspan="2">IMC Capacity</th>
            <th class="exa" colspan="2">IMC Query</th>
            <th class="exa" colspan="2">No Memcompress</th>
            <th class="exa" colspan="2">Requests</th>
            <th class="exa" colspan="2">Megabytes</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Failures</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="cc_iwrites_delta"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="cc_iwrites_delta">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cciowpop']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cciowpop']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cciowpop']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cciowpop']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2crw']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc2crw']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2qrw']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc2qrw']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc1rw']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc1rw']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2crw']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc2crw']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2qrw']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc2qrw']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc1rw']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc1rw']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='ccevt']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='ccevt']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='ccevt']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='ccevt']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='ccfail']/@rq" mode="int"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for CC population  - current                        -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='cc_iwrites']" mode="cc_iwrites_curr">
    <a name="CELL_COLUMNAR_CACHE_IWRITES_CURRENT"/>
    <h4 class="exa">Columnar Cache Population - Current</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Population Jobs - number of outstanding background population jobs at the time of the end snapshot</li>
          <li class="exa">Failures - population failures due to flash cache space</li>
          <li class="exa">values are at the time of the end snapshot</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Columnar Cacheh population information">
          <tr>
            <td></td>
            <th class="exa" colspan="3">Rewrite Requests</th>
            <th class="exa" colspan="3">Rewrite Megabytes</th>
            <td></td>
            <td></td>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">IMC Capacity</th>
            <th class="exa">IMC Query</th>
            <th class="exa">No Memcompress</th>
            <th class="exa">IMC Capacity</th>
            <th class="exa">IMC Query</th>
            <th class="exa">No Memcompress</th>
            <th class="exa">Population Jobs</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="cc_ireads_curr"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="cc_ireads_curr">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2crw']/@rqcurr" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2qrw']/@rqcurr" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc1rw']/@rqcurr" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2crw']/@mbcurr" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='cc2qrw']/@mbcurr" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='cc1rw']/@mbcurr" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='ccbgpop']/@rqcurr" mode="int"/>
      </td>
    </tr>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache scan population                     -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='fcs_pop']">
  <a name="CELL_FLASH_CACHE_SCAN_POP"/>
    <h4 class="exa">Flash Cache Scan Population</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='fcs_pop']/cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Ordered by Total Replacements desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Flash Cache write statistics">
          <tr>
            <td></td>
            <th class="exa" colspan="4">Replacements</th>
            <td></td>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">OLTP</th>
            <th class="exa">DW</th>
            <th class="exa">Self</th>
            <th class="exa">Zero Hit</th>
            <th class="exa">Free Headers Used</th>
          </tr>
          <xsl:apply-templates select="cell" mode="fcs_pop"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <xsl:if test="$hasEF = 'Y'">
          <p>This environment has EF cells.</p>
        </xsl:if>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for flash cache scan population - individual rows   -->
  <!--  ============================================================ -->
  <xsl:template match="cell" mode="fcs_pop">

    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcsrepoltp']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcsrepdw']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcsrepself']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcsrepzhit']/@rq" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='fcsfrhdr']/@rq" mode="int"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for RAM/Memory Cache -->
  <!-- ============================================================ -->

  <!-- ram cache space -->
  <xsl:template match="//cellstats[@type='rc_spc']">
    <a name="CELL_RAM_CACHE_SPACE"/>
    <h4 class="exa">Memory Cache Space usage</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">Space is at the time of the end snapshot</li>
          <li class="exa">ordered by Space Usage desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Memory Cache space usage">
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Space Allocated</th>
            <th class="exa">% OLTP</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="rc_space"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="rc_space">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
        <xsl:if test="./@name = $NAME_ALL">
          <xsl:value-of select="concat(' (',./@num_cells,')')"/>
        </xsl:if>
      </td>
      <!-- convert to GB, XML has MB -->
      <td align="right">
        <xsl:apply-templates select="./stat[@name='rcby']/@spcmb" mode="formatMB"/>
      </td>
      <td align="right">
        <xsl:attribute name="title">
          <xsl:apply-templates select="./stat[@name='rcbyo']/@spcmb" mode="formatMB"/>
        </xsl:attribute>
        <xsl:apply-templates select="./stat[@name='rcbyo']/@ratio" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ram cache reads -->
  <xsl:template match="//cellstats[@type='rc_ureads']">
    <a name="CELL_RAM_CACHE_UREADS"/>
    <h4 class="exa">Memory Cache User Reads</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">ordered by hits desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Memory Cache user read statistics">
          <tr>
            <td></td>
            <th class="exa" colspan="5">Read Requests</th>
            <th class="exa" colspan="4">Read MB</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Hits</th>
            <th class="exa">Hits per Sec</th>
            <th class="exa">%Hit</th>
            <th class="exa">Misses</th>
            <th class="exa">Misses per Sec</th>
            <th class="exa">Hits MB</th>
            <th class="exa">Hits MB/s</th>
            <th class="exa">Misses MB</th>
            <th class="exa">Misses MB/s</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="rc_ureads"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="rc_ureads">

    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='rcior']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='rcior']/@rqps" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='rcior']/@ratio" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='rciorm']/@rq" mode="int"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='rciorm']/@rqps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='rcior']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='rcior']/@mbps" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./stat[@name='rciorm']/@mb" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./stat[@name='rciorm']/@mbps" mode="number"/>
      </td>
    </tr>
  </xsl:template>

  <!-- ram cache writes -->
  <xsl:template match="//cellstats[@type='rc_iwrites']">
    <a name="CELL_RAM_CACHE_IWRITES"/>
    <h4 class="exa">Memory Cache Internal Writes</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa"><xsl:value-of select="$cellCollectionMessage"/></li>
          <li class="exa">ordered by total write requests desc</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Memory Cache write statistics">
          <tr>
            <td></td>
            <th class="exa" colspan="2">Population Write Requests</th>
            <th class="exa" colspan="2">Population Write MB</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="rc_iwrites"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="rc_iwrites">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
      <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td class="exa" align="right">
        <xsl:apply-templates select="./stat[@name='rciowpop']/@rq" mode="int"/>
      </td>
      <td class="exa" align="right">
        <xsl:apply-templates select="./stat[@name='rciowpop']/@rqps" mode="number"/>
      </td>
      <td class="exa" align="right">
        <xsl:apply-templates select="./stat[@name='rciowpop']/@mb" mode="number"/>
      </td>
      <td class="exa" align="right">
        <xsl:apply-templates select="./stat[@name='rciowpop']/@mbps" mode="number"/>
      </td>
    </tr>    
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for IO Reasons  Requests                            -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='ioreason']" mode="ioreason_by_rq">
    <a name="CELL_IOREASON_REQ"/>
    <h4 class="exa">Top IO Reasons by Requests</h4>

    <xsl:choose>
      <xsl:when test="count(./cell/reason/stat[@name='rq']) &gt; 0">

        <ul>
          <li class="exa">The top IO reasons by requests per cell are displayed</li>
          <li class="exa">Only reasons with over <xsl:value-of select="$pctReason"/>% of IO requests for each cell are displayed</li>
          <li class="exa">At most <xsl:value-of select="$topReason"/> reasons are displayed per cell</li>
          <li class="exa">%Cell - the percentage of IO requests on the cell due to the IO reason</li>
          <li class="exa">Ordered by Cell Name, Requests Value desc</li>
        </ul>

        <table class="exa" border="0" summary="This table displays the top IO reasons by requests per cell">
          <tr>
            <td></td>
            <td></td>
            <th class="exa" colspan="3">Requests</th>
            <th class="exa" colspan="2">MB</th>
            <td></td>
          </tr>
          <tr class="exa">
            <th class="exa">Cell Name</th>
            <th class="exa">IO Reason</th>
            <th class="exa">%Cell</th>
            <th class="exa">Total Requests</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total MB</th>
            <th class="exa">per Sec</th>
          </tr>
          <!-- process individual cells -->
          <xsl:for-each select="./cell">
            <xsl:variable name="cellName" select="./@name"/>
            <!-- get reasons and sort by rank within cell -->
            <xsl:for-each select="./reason">
              <xsl:sort select="./stat[@name='rq']/@rn" data-type="number"/>
              <xsl:variable name="reasonName" select="./@name"/>
              <!-- only display non-zero values -->
              <xsl:if test="number(./stat[@name='rq']/@rn) &lt;= $topReason and ./stat[@name='rq']/@value &gt; 0">
                <tr class="exa">
                  <!-- only display cell name for first reason -->
                  <xsl:choose>
                    <xsl:when test="./stat[@name='rq']/@rn = 1">
                      <td><xsl:value-of select="$cellName"/></td>
                    </xsl:when>
                    <xsl:otherwise>
                      <td></td>
                    </xsl:otherwise>
                  </xsl:choose>
                  <td class="exabr"><xsl:value-of select="$reasonName"/></td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@pct" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='rq']/@value" mode="int"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='mb']/@value" mode="number"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@psec" mode="number"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!--  ============================================================ -->
  <!--  TEMPLATE for IO Reasons  MB                                  -->
  <!--  ============================================================ -->
  <xsl:template match="//cellstats[@type='ioreason']" mode="ioreason_by_mb">
    <a name="CELL_IOREASON_MB"/>
    <h4 class="exa">Top IO Reasons by MB</h4>
    <xsl:choose>
      <xsl:when test="count(./cell/reason/stat[@name='mb']) &gt; 0">
        <ul>
          <li class="exa">The top reasons by MB per cell are displayed</li>
          <li class="exa">Only reasons with over <xsl:value-of select="$pctReason"/>% of IO MB for each cell are displayed</li>
          <li class="exa">At most <xsl:value-of select="$topReason"/> reasons are displayed per cell</li>
          <li class="exa">%Cell - the percentage of MB on the cell due to the IO reason</li>
          <li class="exa">Ordered by Cell Name, MB Value desc</li>
        </ul>

        <table class="exa" border="0" summary="This table displays the top IO reasons by requests per cell">
          <tr>
            <td></td>
            <td></td>
            <th class="exa" colspan="3">MB</th>
            <th class="exa" colspan="2">Requests</th>
          </tr>
          <tr class="exa">
            <th class="exa">Cell Name</th>
            <th class="exa">IO Reason</th>
            <th class="exa">%Cell</th>
            <th class="exa">Total MB</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total Requests</th>
            <th class="exa">per Sec</th>
          </tr>
          <!-- process individual cells -->
          <xsl:for-each select="./cell">
            <xsl:variable name="cellName" select="./@name"/>
            <!-- get reasons and sort by rank within cell -->
            <xsl:for-each select="./reason">
              <xsl:sort select="./stat[@name='mb']/@rn" data-type="number"/>
              <xsl:variable name="reasonName" select="./@name"/>
              <!-- only display non-zero values -->
              <xsl:if test="number(./stat[@name='mb']/@rn) &lt;= $topReason and ./stat[@name='mb']/@value &gt; 0">
                <tr class="exa">
                  <!-- only display cellname for first reason -->
                  <xsl:choose>
                    <xsl:when test="./stat[@name='mb']/@rn = 1">
                      <td><xsl:value-of select="$cellName"/></td>
                    </xsl:when>
                    <xsl:otherwise>
                      <td></td>
                    </xsl:otherwise>
                  </xsl:choose>
                  <td class="exabr"><xsl:value-of select="$reasonName"/></td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@pct" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='mb']/@value" mode="number"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@psec" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='rq']/@value" mode="int"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>

        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:template match="@is_curr">
    <xsl:value-of select="'(*)'"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Top Database by Requests                        -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='topdb']" mode="topdb_by_rq">
    <a name="CELL_TOPDB_REQ"/>
    <h4 class="exa">Top Databases by IO Requests</h4>
    <xsl:choose>
      <xsl:when test="./db">
        <ul>
          <li class="exa">The top <xsl:value-of select="$topDbs"/> databases by IO Requests are displayed</li>
          <xsl:if test="count(./db/@is_curr) &gt; 0">
            <li class="exa">(*) indicates current database.  Current database is always displayed.</li>
          </xsl:if>
          <li class="exa">%Captured - % of Captured DB IO requests</li>
          <li class="exa">Total - total IO requests or IO throughput (Flash + Disk)</li>
          <li class="exa">Ordered by IO requests desc</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays the top databases by IOPs">
          <tr>
            <td></td>
            <td></td>
            <th class="exa" colspan="5">IO Requests</th>
            <th class="exa" colspan="4">IO Throughput (MB)</th>
          </tr>
          <tr>
            <th class="exa">DB Name</th>
            <th class="exa">DBID</th>
            <th class="exa">%Captured</th>
            <th class="exa">Total Requests</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Total MB</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
          </tr>

          <!-- process individual rows -->
          <xsl:for-each select="./db">
            <xsl:sort select="./stat[@name='rq']/@rn" data-type="number"/>
            <!-- only display topN databases and current db -->
            <xsl:if test="./stat[@name='rq']/@rn &lt;= $topDbs or ./@is_curr">
              <xsl:variable name="dbName" select = "./@name"/>
              <xsl:variable name="dbId" select="./@id"/>
              <tr class="exa">
                <td>
                  <!-- should only be a link of we have request details -->
                  <xsl:choose>
                    <xsl:when test="$hasDbRqDetail = 'Y'">
                      <a>
                        <xsl:attribute name="href">
                          <xsl:value-of select="concat('#CELL_TOPDB_REQ_DETAIL-',$dbName)"/>
                        </xsl:attribute>
                        <xsl:value-of select="$dbName"/>
                      </a>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="$dbName"/>
                    </xsl:otherwise>
                  </xsl:choose><xsl:apply-templates select="./@is_curr"/>
                </td>
                <td align="right" class="exabr"><xsl:value-of select="$dbId"/></td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='rq']/@pct" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='rq']/@tot" mode="int"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='rq']/@fc" mode="int"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='rq']/@hd" mode="int"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='mb']/@tot" mode="number"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='mb']/@psec" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='mb']/@fc" mode="number"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='mb']/@hd" mode="number"/>
                </td>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Top Database by Request - Details               -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='topdb']" mode="topdb_by_rq_detail">
    <a name="CELL_TOPDB_REQ_DETAIL"/>
    <h4 class="exa">Top Databases By Requests - Details</h4>
    <xsl:choose>
      <xsl:when test="./db/stat[@name='rq']/rqs">
        <ul>
          <li class="exa">Request details for the top databases by IO requests</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays top database by IOPS details">
          <tr>
            <td></td><td></td><td></td>
            <th class="exa" colspan="7">Small Requests</th>
            <th class="exa" colspan="7">Large Requests</th>
          </tr>
          <tr>
            <td></td><td></td><td></td>
            <th class="exa" colspan="3">Reqs/s</th>
            <th class="exa" colspan="2">Latency</th>
            <th class="exa" colspan="2">Queue Time</th>
            <th class="exa" colspan="3">Reqs/s</th>
            <th class="exa" colspan="2">Latency</th>
            <th class="exa" colspan="2">Queue Time</th>
          </tr>
          <tr>
            <th class="exa">DB Name</th>
            <th class="exa">DBID</th>
            <th class="exa">IOs/s</th>
            <th class="exa">Total</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Total</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
          </tr>
          <!-- sort rows by requests -->
          <xsl:for-each select="./db">
            <xsl:sort select="./stat[@name='rq']/@rn" data-type="number"/>
            <xsl:if test="./stat[@name='rq']/@rn &lt;= $topDbs or ./@is_curr">
              <xsl:variable name="dbName" select="./@name"/>
            <xsl:variable name="dbId" select="./@id"/>
              <tr class="exa">
                <td>
                  <!-- drop an anchor -->
                  <a>
                    <xsl:attribute name="name">
                      <xsl:value-of select="concat('CELL_TOPDB_REQ_DETAIL-',$dbName)"/>
                    </xsl:attribute>
                  </a>
                  <xsl:value-of select="$dbName"/><xsl:apply-templates select="./@is_curr"/>
                </td>
                <td class="exabr"><xsl:value-of select="dbId"/></td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                </td>
                <xsl:if test="not(./stat[@name='rq']/rqs/rq[@type='small'])">
                  <td></td><td class="exabr"></td>
                  <td></td><td class="exabr"></td>
                  <td></td><td class="exabr"></td>
                </xsl:if>
                <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']" mode="topdb_by_rq_detail"/>
                <xsl:if test="not(./stat[@name='rq']/rqs/rq[@type='small'])">
                  <td></td><td class="exabr"></td>
                  <td></td><td class="exabr"></td>
                  <td></td><td class="exabr"></td>
                </xsl:if>
                <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='large']" mode="topdb_by_rq_detail"/>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:template match="rq" mode="topdb_by_rq_detail">
    <td align="right">
      <xsl:apply-templates select="./@psec" mode="number"/>
    </td>
    <td align="right">
      <xsl:attribute name="title"><xsl:apply-templates select="./@fcpct" mode="number"/>%</xsl:attribute>
      <xsl:apply-templates select="./@fcps" mode="number"/>
    </td>
    <td align="right" class="exabr">
      <xsl:attribute name="title"><xsl:apply-templates select="./@hdpct" mode="number"/>%</xsl:attribute>
      <xsl:apply-templates select="./@hdps" mode="number"/>
    </td>
    <td align="right">
      <xsl:apply-templates select="./@fclt" mode="formatMs"/>
    </td>
    <td align="right" class="exabr">
      <xsl:apply-templates select="./@hdlt" mode="formatMs"/>
    </td>
    <td align="right">
      <xsl:apply-templates select="./@fcqt" mode="formatMs"/>
    </td>
    <td align="right" class="exabr">
      <xsl:apply-templates select="./@hdqt" mode="formatMs"/>
    </td>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for Top Database by Throughput                      -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='topdb']" mode="topdb_by_mb">
    <a name="CELL_TOPDB_MB"/>
    <h4 class="exa">Top Databases by IO Throughput</h4>
    <xsl:choose>
      <xsl:when test="./db/stat[@name='mb']">
        <ul>
          <li class="exa">The top <xsl:value-of select="$topDbs"/> databases by IO Throughput are displayed</li>
          <xsl:if test="count(./db/@is_curr) &gt; 0">
            <li class="exa">(*) indicates current database.  Current database is always displayed.</li>
          </xsl:if>
          <li class="exa">%Captured - % of Captured DB IO throughput</li>
          <li class="exa">Total - total IO throughput or IO requests (Flash + Disk)</li>
          <li class="exa">Ordered by IO Throughput desc</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays the top databases by IOPs">
          <tr>
            <td></td>
            <td></td>
            <th class="exa" colspan="5">IO Throughput (MB)</th>
            <th class="exa" colspan="4">IO Requests</th>
          </tr>
          <tr>
            <th class="exa">DB Name</th>
            <th class="exa">DBID</th>
            <th class="exa">%Captured</th>
            <th class="exa">Total MB</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Total Requests</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
          </tr>
          <!-- process individual rows -->
          <!-- TODO: XML should contain sort order by database -->
          <!-- and change sort criteria -->
          <xsl:for-each select="./db">
            <xsl:sort select="./stat[@name='mb']/@rn" data-type="number"/>
            <xsl:if test="./stat[@name='mb']/@rn &lt;= $topDbs or ./@is_curr">
              <xsl:variable name="dbName" select="./@name"/>
              <xsl:variable name="dbId" select="./@id"/>
              <tr class="exa">
                <td><xsl:value-of select="$dbName"/><xsl:apply-templates select="./@is_curr"/></td>
                <td align="right"><xsl:value-of select="$dbId"/></td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='mb']/@pct" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='mb']/@tot" mode="number"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='mb']/@psec" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='mb']/@fc" mode="number"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='mb']/@hd" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='rq']/@tot" mode="int"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                </td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='rq']/@fc" mode="int"/>
                </td>
                <td align="right" class="exabr">
                  <xsl:apply-templates select="./stat[@name='rq']/@hd" mode="int"/>
                </td>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Top Database by Requests per Cell               -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='dbpercell']" mode="dbpercell_by_rq">
    <a name="CELL_TOPDB_REQ_CELL"/>
    <h4 class="exa">Top Databases by IO Requests per Cell</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa">Within each cell the top <xsl:value-of select="$topDbPerCell"/> databases by IO requests are displayed</li>
          <xsl:if test="count(./cell/db/@is_curr) &gt; 0">
            <li class="exa">(*) indicates current database.  Current database is always displayed.</li>
          </xsl:if>
          <li class="exa">%Cell - % of Captured DB IOs on the Cell</li>
          <li class="exa">Ordered by cell name, IO requests desc</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays the top databases by IOPs">
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <th class="exa" colspan="5">IO Requests</th>
            <th class="exa" colspan="4">IO Throughput (MB)</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">DB Name</th>
            <th class="exa">DBID</th>
            <th class="exa">%Cell</th>
            <th class="exa">Total Requests</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Total MB</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
          </tr>
          <!-- process invididual cells  -->
          <xsl:for-each select="./cell">
            <xsl:variable name="cellName" select="./@name"/>
            <xsl:for-each select="./db">
              <xsl:sort select="./stat[@name='rq']/@rn" data-type="number"/>
              <xsl:variable name="dbName" select="./@name"/>
              <xsl:variable name="dbId" select="./@id"/>
              <xsl:if test="number(./stat[@name='rq']/@rn) &lt;= $topDbPerCell or ./@is_curr">
                <tr class="exa">
                  <!-- display cellName for first db -->
                  <td>
                    <xsl:if test="./stat[@name='rq']/@rn = 1">
                      <xsl:choose>
                        <xsl:when test="$hasDbRqDetail = 'Y'">
                          <a>
                            <xsl:attribute name="href">
                              <xsl:value-of select="concat('#CELL_TOPDB_REQ_CELL_DETAIL-',$cellName)"/>
                            </xsl:attribute>
                            <xsl:value-of select="$cellName"/>
                          </a>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="$cellName"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:if>
                  </td>
                  <td>
                    <xsl:choose>
                      <xsl:when test="$hasDbRqDetail = 'Y'">
                        <a>
                          <xsl:attribute name="href">
                            <xsl:value-of select="concat('#CELL_TOPDB_REQ_CELL_DETAIL-',$cellName,'-',$dbName)"/>
                          </xsl:attribute>
                          <xsl:value-of select="$dbName"/>
                        </a>
                      </xsl:when>
                      <xsl:otherwise>
                          <xsl:value-of select="$dbName"/>
                      </xsl:otherwise>
                    </xsl:choose><xsl:apply-templates select="./@is_curr"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:value-of select="$dbId"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@pct" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='rq']/@tot" mode="int"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='rq']/@fc" mode="int"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@hd" mode="int"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='mb']/@tot" mode="number"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@psec" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='mb']/@fc" mode="number"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@hd" mode="number"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Top Database by Requests per Cell - Detail      -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='dbpercell']" mode="dbpercell_by_rq_detail">
    <a name="CELL_TOPDB_REQ_CELL_DETAIL"/>
    <h4 class="exa">Top Databases by IO Requests per Cell - Details</h4>
    <xsl:choose>
      <xsl:when test="./cell/db/stat[@name='rq']/rqs">
        <ul>
          <li class="exa">Request details for the top databases per cell</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays the top databases by IOPs">
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <th class="exa" colspan="7">Small Requests</th>
            <th class="exa" colspan="7">Large Requests</th>
          </tr>
          <tr>
            <td></td><td></td><td></td>
            <td></td>
            <th class="exa" colspan="3">Reqs/s</th>
            <th class="exa" colspan="2">Latency</th>
            <th class="exa" colspan="2">Queue Time</th>
            <th class="exa" colspan="3">Reqs/s</th>
            <th class="exa" colspan="2">Latency</th>
            <th class="exa" colspan="2">Queue Time</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">DB Name</th>
            <th class="exa">DBID</th>
            <th class="exa">IOs/s</th>
            <th class="exa">Total</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Total</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
          </tr>
          <!-- process invididual cells  -->
          <xsl:for-each select="./cell">
            <xsl:variable name="cellName" select="./@name"/>
            <xsl:for-each select="./db">
              <xsl:sort select="./stat[@name='rq']/@rn" data-type="number"/>
              <xsl:variable name="dbName" select="./@name"/>
              <xsl:variable name="dbId" select="./@id"/>
              <xsl:if test="number(./stat[@name='rq']/@rn) &lt;= $topDbPerCell or ./@is_curr">
                <tr class="exa">
                  <td>
                    <!-- display cellname for first row only -->
                    <xsl:if test="./stat[@name='rq']/@rn = 1">
                      <!-- drop anchor -->
                      <a>
                        <xsl:attribute name="name">
                          <xsl:value-of select="concat('CELL_TOPDB_REQ_CELL_DETAIL-',$cellName)"/>
                        </xsl:attribute>
                      </a>
                      <xsl:value-of select="$cellName"/>
                    </xsl:if>
                  </td>
                  <td>
                    <a>
                      <xsl:attribute name="name">
                        <xsl:value-of select="concat('CELL_TOPDB_REQ_CELL_DETAIL-',$cellName,'-',$dbName)"/>
                      </xsl:attribute>
                    </a>
                    <xsl:value-of select="$dbName"/><xsl:apply-templates select="./@is_curr"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:value-of select="$dbId"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                  </td>
                  <xsl:if test="not(./stat[@name='rq']/rqs/rq[@type='small'])">
                    <td></td><td></td><td class="exabr"></td>
                    <td></td><td class="exabr"></td>
                    <td></td><td class="exabr"></td>
                  </xsl:if>
                  <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']" mode="topdb_by_rq_detail"/>
                  <xsl:if test="not(./stat[@name='rq']/rqs/rq[@type='large'])">
                    <td></td><td></td><td class="exabr"></td>
                    <td></td><td class="exabr"></td>
                    <td></td><td class="exabr"></td>
                  </xsl:if>
                  <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='large']" mode="topdb_by_rq_detail"/>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Top Database by Throughput per Cell             -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='dbpercell']" mode="dbpercell_by_mb">
    <a name="CELL_TOPDB_MB_CELL"/>
    <h4 class="exa">Top Databases by IO Throughput per Cell</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa">Within each cell the top <xsl:value-of select="$topDbPerCell"/> databases by IO throughput are displayed</li>
          <xsl:if test="count(./cell/db/@is_curr) &gt; 0">
            <li class="exa">(*) indicates current database. Current database is always displayed.</li>
          </xsl:if>
          <li class="exa">%Cell - % of Captured DB IOs on the Cell</li>
          <li class="exa">Ordered by cell name, IO throughput desc</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays the top databases by IOPs">
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <th class="exa" colspan="5">IO Throughput (MB)</th>
            <th class="exa" colspan="4">IO Requests</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">DB Name</th>
            <th class="exa">DBID</th>
            <th class="exa">%Cell</th>
            <th class="exa">Total MB</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
            <th class="exa">Total Requests</th>
            <th class="exa">per Sec</th>
            <th class="exa">Flash</th>
            <th class="exa">Disk</th>
          </tr>
          <!-- process invididual cells  -->
          <xsl:for-each select="./cell">
            <xsl:variable name="cellName" select="./@name"/>
            <xsl:for-each select="./db">
              <xsl:sort select="./stat[@name='mb']/@rn" data-type="number"/>
              <xsl:variable name="dbName" select="./@name"/>
              <xsl:variable name="dbId" select="./@id"/>
              <xsl:if test="number(./stat[@name='mb']/@rn) &lt;= $topDbPerCell or ./@is_curr">
                <tr class="exa">
                  <!-- display cellName for first db -->
                  <td>
                    <xsl:if  test="./stat[@name='mb']/@rn = 1">
                      <xsl:value-of select="$cellName"/>
                    </xsl:if>
                  </td>
                  <td><xsl:value-of select="$dbName"/><xsl:apply-templates select="./@is_curr"/></td>
                  <td align="right" class="exabr">
                    <xsl:value-of select="$dbId"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@pct" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='mb']/@tot" mode="number"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@psec" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='mb']/@fc" mode="number"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='mb']/@hd" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='rq']/@tot" mode="int"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@psec" mode="number"/>
                  </td>
                  <td align="right">
                    <xsl:apply-templates select="./stat[@name='rq']/@fc" mode="int"/>
                  </td>
                  <td align="right" class="exabr">
                    <xsl:apply-templates select="./stat[@name='rq']/@hd" mode="int"/>
                  </td>
                </tr>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- bug22053453: in case we ignored some databases we could not prorate -->
  <!--              values, we display a warning                           -->
  <xsl:template match="//cellstats[@type='topdb_missing']">
    <xsl:if test="./estd/db">
      Warning: The I/Os were estimated for the following databases that were not in the begin snapshot:<br/>
      <xsl:apply-templates select="./estd/db" mode="list">
        <xsl:with-param name="sep">
          <xsl:choose>
            <xsl:when test="position() != last()">
              <xsl:value-of select="', '"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="''"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:with-param>
      </xsl:apply-templates>
    </xsl:if>
    <xsl:if test="./missing/db">
    Warning:  Could not determine the amount of IOs for the following databases<br/>
    Some cells or databases may be missing from previous snapshots<br/>
      <xsl:apply-templates select="./missing/db" mode="list"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="db" mode="list">
    <xsl:param name="sep"/>
    <xsl:value-of select="concat(./@name,$sep)"/>
  </xsl:template>

  <!-- TEMPLATES for Flash cache performance Summary -->
  <xsl:template name="flashCacheIOSummary">
    <p>I/O Summary</p>
    <xsl:choose>
      <xsl:when test="$minReportIntervalMsg = 'N'">
        <ul>
          <li class="exa">average requests/second and MB/s per disk</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table contains IO performance summary">
          <tr>
            <td></td>
            <th class="exa" colspan="2">Requests</th>
            <th class="exa" colspan="2">Throughput</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Reads/s</th>
            <th class="exa">Writes/s</th>
            <th class="exa">Read MB/s</th>
            <th class="exa">Write MB/s</th>
          </tr>
          <!-- get summary from cellsrv stat -->
          <xsl:for-each select="//cellstats[@type='cell_srviorq']/cells/cell[@name=$NAME_ALL]">
            <xsl:variable name="diskType">
              <xsl:value-of select="../@disk_type"/>
            </xsl:variable>
            <tr class="exa">
              <td><xsl:value-of select="$diskType"/></td>
              <td align="right">
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="'#CELLSRV_IOPS_CELL'"/>
                  </xsl:attribute>
                  <xsl:call-template name="formatNumber">
                    <xsl:with-param name="n" select="./stat[@name='srrq']/@mean + ./stat[@name='lrrq']/@mean"/>
                  <xsl:with-param name="blankToZero" select="'Y'"/>
                  </xsl:call-template>
                </a>
              </td>
              <td align="right">
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="'#CELLSRV_IOPS_CELL'"/>
                  </xsl:attribute>
                  <xsl:call-template name="formatNumber">
                    <xsl:with-param name="n" select="./stat[@name='swrq']/@mean + ./stat[@name='lwrq']/@mean"/>
                    <xsl:with-param name="blankToZero" select="'Y'"/>
                  </xsl:call-template>
                </a>
              </td>
              <td align="right">
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="'#CELLSRV_MBPS_CELL'"/>
                  </xsl:attribute>
                  <xsl:call-template name="formatNumber">
                    <xsl:with-param name="n" select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='srmb']/@mean + //cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lrmb']/@mean"/>
                    <xsl:with-param name="blankToZero" select="'Y'"/>
                  </xsl:call-template>
                </a>
              </td>
              <td align="right">
                <a>
                  <xsl:attribute name="href">
                    <xsl:value-of select="'#CELLSRV_MBPS_CELL'"/>
                  </xsl:attribute>
                  <xsl:call-template name="formatNumber">
                    <xsl:with-param name="n" select="//cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='swmb']/@mean + //cellstats[@type='cell_srviomb']/cells[@disk_type=$diskType]/cell[@name=$NAME_ALL]/stat[@name='lwmb']/@mean"/>
                    <xsl:with-param name="blankToZero" select="'Y'"/>
                  </xsl:call-template>
                </a>
              </td>
            </tr>
          </xsl:for-each>
        </table>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$noDataMsg"/>
        </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <!-- TEMPLATE for Flash Cache Savings -->
  <xsl:template name="flashCacheSavings">
    <p>Cache Savings</p>
      <ul>
        <li class="exa">Disk write savings (overwrites) - writes absorbed by flash cache that would have otherwise gone to disk</li>
        <li class="exa">Database Flash Cache Hit% - for the database, not restricted to an instance</li>
        <li class="exa">Cell Flash Cache OLTP and Scan Hit% - for the cells, not restricted to this database or instance</li>
        <xsl:if test="$hasRamCache = 'Y'">
          <li class="exa">Cell Memory Cache Hit% - for the cells, not restricted to this database or instance</li>
        </xsl:if>
      </ul>
      <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary">
        <tr class="exa">
          <td>Database Flash Cache Hit %</td>
          <td align="right"><xsl:value-of select="./hit"/></td>
        </tr>
        <!-- only display this if we have a temp hit % -->
        <xsl:if test="./summary[@type='fc_temp']/hit">
          <tr class="exa">
            <td>Database Flash Cache Temp Read Hit %</td>
            <td align="right"><xsl:value-of select="./summary[@type='fc_temp']/hit/@read"/></td>
          </tr>
          <tr class="exa">
            <td>Database Flash Cache Temp Write Hit %</td>
            <td align="right"><xsl:value-of select="./summary[@type='fc_temp']/hit/@write"/></td>
          </tr>
        </xsl:if>
        <tr class="exa">
          <td><a href="#CELL_FLASH_CACHE_UREADS_EFF">Cell Flash Cache OLTP Hit %</a></td>
          <td align="right">
            <xsl:value-of select="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]/stat[@name='fcioroltp']/@ratio"/>
          </td>
        </tr>
        <tr class="exa">
          <td><a href="#CELL_FLASH_CACHE_UREADS_EFF">Cell Flash Cache Scan Hit %</a></td>
          <td align="right">
            <xsl:value-of select="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]/stat[@name='fciordw']/@ratio"/>
          </td>
        </tr>
        <xsl:if test="$hasRamCache = 'Y'">
          <tr class="exa">
            <td><a href="#CELL_RAM_CACHE_UREADS">Cell Memory Hit%</a></td>
            <td align="right">
              <xsl:value-of select="//cellstats[@type='rc_ureads']/cell[@name=$NAME_ALL]/stat[@name='rcior']/@ratio"/>
            </td>
          </tr>
        </xsl:if>
        <tr class="exa">
          <td><a href="#CELL_FLASH_CACHE_UWRITES">Disk Write savings/s</a></td>
          <td align="right">
            <xsl:apply-templates select="//cellstats[@type='fc_uwrites']/cell[@name=$NAME_ALL]/stat[@name='fciowow']/@rqps" mode="number"/>
          </td>
        </tr>
        <!-- only display if we have large writes -->
        <xsl:if test="$hasFlashCacheLW = 'Y'">
          <tr class="exa">
            <td><a href="#CELL_FLASH_CACHE_UWRITES_LW">Large Writes/s</a></td>
            <td align="right">
              <xsl:apply-templates select="//cellstats[@type='fc_uwrites']/cell[@name='All']" mode="getLWTotal"/>
            </td>
          </tr>
        </xsl:if>
      </table>
  </xsl:template>

  <!-- TEMPLATE for flash cache disk activity -->
  <xsl:template name="flashCacheDiskActivity">
    <p>Disk Activity</p>
    <ul>
      <li class="exa">Flash cache activity resulting in disk I/O</li>
      <li class="exa">Read Misses - reads from disk, writes to flash</li>
      <li class="exa">Disk Writer - reads from flash, writes to disk</li>
    </ul>
      <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary disk activity">
        <tr><th class="exa" colspan="2">I/O per second</th></tr>
        <tr class="exa">
          <td><a href="#CELL_FLASH_CACHE_UREADS_PSEC">Read Misses</a></td>
          <td align="right">
            <xsl:apply-templates select="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]/stat[@name='fciorm']/@rqps" mode="number"/>
          </td>
        </tr>
        <tr>
          <td><a href="#CELL_FLASH_CACHE_IREADS">Disk writer</a></td>
          <td align="right">
            <xsl:apply-templates select="//cellstats[@type='fc_ireads']/cell[@name=$NAME_ALL]/stat[@name='fciordw']/@rqps" mode="number"/>
          </td>
        </tr>
        <!-- note, this is only available if we minimum report interval -->
        <xsl:if test="$minReportIntervalMsg = 'N'">
          <tr><th class="exa" colspan="2">% Utilization</th></tr>
          <!-- loop over all hard disks -->
          <xsl:for-each select="//cellstats[@type='cell_osstat']/cells/cell[@name=$NAME_ALL]">
            <xsl:variable name="diskType">
              <xsl:value-of select="../@disk_type"/>
            </xsl:variable>
            <!-- only display utilization for hard disks -->
            <xsl:if test="substring($diskType,1,1) = 'H'">
              <tr class="exa">
                <td><a href="#OS_IO_CELL"><xsl:value-of select="$diskType"/></a></td>
                <td align="right">
                  <xsl:apply-templates select="./stat[@name='util']/@mean" mode="number"/>
                </td>
              </tr>
            </xsl:if>
          </xsl:for-each>
        </xsl:if>
      </table>
  </xsl:template>

  <!-- template to loop through histogram buckets -->
  <xsl:template name="histogramLoop">
    <xsl:param name="type"/>
    <xsl:param name="wait"/>
    <xsl:param name="id"/>
    <xsl:if test="$id &lt;= 2097152">
      <td align="right">
        <xsl:apply-templates select="//histogram[@name=$wait]/bkt[@id=$id]" mode="number"/>
        <xsl:if test="//histogram[@name=$wait]/bkt[@id=$id]/@value">
          <xsl:attribute name="title">
            <xsl:value-of select="concat('Bucket: ', $id, '; # of Waits: ', //histogram[@name=$wait]/bkt[@id=$id]/@value)"/>
          </xsl:attribute>
        </xsl:if>
      </td>
      <xsl:call-template name="histogramLoop">
        <xsl:with-param name="type" select="$type"/>
        <xsl:with-param name="wait" select="$wait"/>
        <xsl:with-param name="id">
          <xsl:number value="number($id * 2)"/>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:if>
  </xsl:template>

  <!-- template for displaying single block read information -->
  <xsl:template name="flashCacheSingleBlockReads">
      <p>Single Block Reads</p>
      <ul>
        <li class="exa">cell single block physical read wait time for the database, not restricted to an instance</li>
        <xsl:if test="$hasPmem = 'Y'">
          <li class="exa">cell IO read requests - [local|remote] - for the database, not restricted to an instance</li>
        </xsl:if>
        <li class="exa">% of small reads from flash/disk from the cells, not restricted to this database or instance</li>
        <li class="exa">small reads for flash/disk from the cells, not restricted to this database or instance</li>
        <xsl:if test="$hasPmem = 'Y'">
          <li class="exa">small reads for persistent memory only include remote reads processed by cellsrv</li>
        </xsl:if>
        <li class="exa">Total Small Reads/s - small reads/s for the entire system for the disk type</li>
        <li class="exa">Cell Small Reads/s - average small reads/s for a cell for the disk type</li>
        <li class="exa">Disk Small Reads/s - average small reads/s for a disk for the disk type</li>
      </ul>
      <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary single block reads">
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <th class="exa" colspan="22">% of Total Waits</th>
        </tr>
        <tr>
          <td></td>
          <th class="exa">Total Waits</th>
          <th class="exa">FG Waits</th>
          <th class="exa">Avg Wait</th>
          <th class="exa">&lt;1us</th>
          <th class="exa">&lt;2us</th>
          <th class="exa">&lt;4us</th>
          <th class="exa">&lt;8us</th>
          <th class="exa">&lt;16us</th>
          <th class="exa">&lt;32us</th>
          <th class="exa">&lt;64us</th>
          <th class="exa">&lt;128us</th>
          <th class="exa">&lt;256us</th>
          <th class="exa">&lt;512us</th>
          <th class="exa">&lt;1ms</th>
          <th class="exa">&lt;2ms</th>
          <th class="exa">&lt;4ms</th>
          <th class="exa">&lt;8ms</th>
          <th class="exa">&lt;16ms</th>
          <th class="exa">&lt;32ms</th>
          <th class="exa">&lt;64ms</th>
          <th class="exa">&lt;128ms</th>
          <th class="exa">&lt;256ms</th>
          <th class="exa">&lt;512ms</th>
          <th class="exa">&lt;1s</th>
          <th class="exa">&gt;=1s</th>
        </tr>
        <tr class="exa">
          <td nowrap="true"><xsl:value-of select="//cellstats[@type='fc_summary']/histogram/@name"/></td>
          <td align="right">
            <xsl:apply-templates select="//cellstats[@type='fc_summary']/histogram/@twt" mode="int"/>
          </td>
          <td align="right">
            <xsl:apply-templates select="//cellstats[@type='fc_summary']/waits/@fgwt" mode="int"/>
          </td>
          <td align="right">
            <xsl:attribute name="title">Total Time:<xsl:apply-templates select="//cellstats[@type='fc_summary']/waits/@fgtm" mode="formatMs"/>
            </xsl:attribute>
            <xsl:apply-templates select="//cellstats[@type='fc_summary']/waits/@avtm" mode="formatMs"/>
          </td>
          <xsl:call-template name="histogramLoop">
            <xsl:with-param name="type" select="'fc_summary'"/>
            <xsl:with-param name="wait" select="//cellstats[@type='fc_summary']/histogram/@name"/>
            <xsl:with-param name="id" select="'1'"/>
          </xsl:call-template>
        </tr>
      </table>
      <!-- separate tables for better column widths in the display -->
      <!-- this information is only available if we satisfied min duration -->
      <xsl:if test="$minReportIntervalMsg = 'N'">
        <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary single block reads">
          <!-- only display pmem if we had the stats -->
          <xsl:if test="//cellstats[@type='fc_summary']/pmem">
            <tr>
              <th class="exa">Persistent Memory Reads</th>
              <th class="exa">%Total</th>
              <th class="exa">Reads/s</th>
            </tr>
            <xsl:apply-templates select="//cellstats[@type='fc_summary']/pmem/read"/>
          </xsl:if>
          <tr>
            <th class="exa">Small Reads Distribution</th>
            <th class="exa">%Small Reads</th>
            <th class="exa">Small Reads/s</th>
          </tr>
          <!-- get total IOs -->
          <xsl:variable name="totalDeviceSmallReads">
            <xsl:value-of select="sum(//cellstats[@type='cell_srviorq']/cells/cell[@name=$NAME_ALL]/stat[@name='srrq']/@tot)"/>
          </xsl:variable>
          <xsl:variable name="flashSmallReads">
            <xsl:value-of select="sum(//cellstats[@type='cell_srviorq']/cells[substring(@disk_type,1,1) = 'F']/cell[@name=$NAME_ALL]/stat[@name='srrq']/@tot)"/>
          </xsl:variable>
          <xsl:variable name="diskSmallReads">
            <xsl:value-of select="sum(//cellstats[@type='cell_srviorq']/cells[substring(@disk_type,1,1) = 'H']/cell[@name=$NAME_ALL]/stat[@name='srrq']/@tot)"/>
          </xsl:variable>
          <!-- make sure we do not get NaN since we use this to get total -->
          <xsl:variable name="ramCacheSmallReads">
            <xsl:choose>
              <xsl:when test="//cellstats[@type='rc_ureads']/cell[@name=$NAME_ALL]/stat[@name='rcior']/@rqps">
                <xsl:value-of select="//cellstats[@type='rc_ureads']/cell[@name=$NAME_ALL]/stat[@name='rcior']/@rqps"/>
              </xsl:when>
              <xsl:otherwise>0</xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <!-- calculate total -->
          <xsl:variable name="totalSmallReads">
            <xsl:value-of select="$totalDeviceSmallReads + $ramCacheSmallReads"/>
          </xsl:variable>

          <!-- we only have 'M' for tests, has been changed to 'X' for Dxf-->
          <xsl:variable name="pmemSmallReads">
            <xsl:value-of select="sum(//cellstats[@type='cell_srviorq']/cells[substring(@disk_type,1,1) = 'M' or substring(@disk_type,1,1) = 'X']/cell[@name=$NAME_ALL]/stat[@name='srrq']/@tot)"/>
          </xsl:variable>
          <tr class="exa">
            <td>Flash</td>
            <td align="right">
              <xsl:if test="$totalSmallReads &gt; 0">
                <xsl:call-template name="formatNumber">
                  <xsl:with-param name="n" select="100 * ($flashSmallReads div $totalSmallReads)"/>
                </xsl:call-template>
              </xsl:if>
            </td>
            <td align="right">
              <xsl:call-template name="formatNumber">
                <xsl:with-param name="n" select="$flashSmallReads"/>
              </xsl:call-template>
            </td>
          </tr>
          <tr class="exa">
            <td>Disk</td>
            <td align="right">
              <xsl:if test="$totalSmallReads &gt; 0">
                <xsl:call-template name="formatNumber">
                  <xsl:with-param name="n" select="100 * ($diskSmallReads div $totalSmallReads)"/>
                </xsl:call-template>
              </xsl:if>
            </td>
            <td align="right">
              <xsl:call-template name="formatNumber">
                <xsl:with-param name="n" select="$diskSmallReads"/>
              </xsl:call-template>
            </td>
          </tr>
          <xsl:if test="$hasRamCache = 'Y'">
            <tr class="exa">
              <td>Memory Cache</td>
              <td align="right">
                <xsl:if test="$totalSmallReads &gt; 0">
                  <xsl:call-template name="formatNumber">
                    <xsl:with-param name="n" select="100 * ($ramCacheSmallReads div $totalSmallReads)"/>
                  </xsl:call-template>
                </xsl:if>
              </td>
              <td align="right">
                <xsl:call-template name="formatNumber">
                  <xsl:with-param name="n" select="$ramCacheSmallReads"/>
                </xsl:call-template>
              </td>
            </tr>
          </xsl:if>
          <!-- only display pmem if we had the stats -->
          <xsl:if test="$hasPmem = 'Y'">
            <tr class="exa">
              <td>Persistent Memory</td>
              <td align="right">
                <xsl:if test="$totalSmallReads &gt; 0">
                  <xsl:call-template name="formatNumber">
                    <xsl:with-param name="n" select="100 * ($pmemSmallReads div $totalSmallReads)"/>
                  </xsl:call-template>
                </xsl:if>
              </td>
              <td align="right">
                <xsl:call-template name="formatNumber">
                  <xsl:with-param name="n" select="$pmemSmallReads"/>
                </xsl:call-template>
              </td>
            </tr>
          </xsl:if>
          <!-- now display detail information for flash and hard disks -->
          <xsl:call-template name="smallReadIOPs">
            <xsl:with-param name="selectDiskType" select="'Flash'"/>
          </xsl:call-template>
          <xsl:call-template name="smallReadIOPs">
            <xsl:with-param name="selectDiskType" select="'HardDisk'"/>
          </xsl:call-template>
          <xsl:if test="$hasRamCache = 'Y'">
            <xsl:apply-templates select="//cellstats[@type='rc_ureads']/cell[@name=$NAME_ALL]/stat[@name='rcior']" mode="rc_small_reads"/>
          </xsl:if>
          <!-- only display pmem if we had data -->
          <xsl:if test="$hasPmem = 'Y'">
            <xsl:call-template name="smallReadIOPs">
              <xsl:with-param name="selectDiskType" select="'PmemDisk'"/>
            </xsl:call-template>
          </xsl:if>
        </table>
      </xsl:if>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying pmem reads for fc summary            -->
  <!-- ============================================================ -->

  <xsl:template match="//cellstats[@type='fc_summary']/pmem/read">
    <tr class="exa">
      <td><xsl:value-of select="./@type"/></td>
      <td align="right"><xsl:apply-templates select="./@pct" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./@psec" mode="number"/></td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying small reads summary for fc summary   -->
  <!-- ============================================================ -->
  <xsl:template name="smallReadIOPs">
    <xsl:param name="selectDiskType"/>
    <!-- displayName is either Flash, Disk or Persistent Memory' -->
    <xsl:variable name="displayName">
      <xsl:choose>
        <xsl:when test="$selectDiskType = 'HardDisk'">
          <xsl:value-of select="'Disk'"/>
        </xsl:when>
        <xsl:when test="$selectDiskType = 'PmemDisk'">
          <xsl:value-of select="'Persistent Memory'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$selectDiskType"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- get first letter of disk type to identify rows we want -->
    <xsl:variable name="selectDiskTypeSubstr">
      <xsl:choose>
        <xsl:when test="$selectDiskType = 'PmemDisk'">
          <xsl:value-of select="'M'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="substring($selectDiskType,1,1)"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- start row header -->
    <tr>
      <th class="exa">Small Reads - <xsl:value-of select="$displayName"/></th>
      <th class="exa"># Cells</th>
      <th class="exa">Total Small Reads/s</th>
      <th class="exa">Cell Small Reads/s</th>
      <th class="exa">Disk Small Reads/s</th>
      <th class="exa">Latency</th>
    </tr>
    <!-- loop through individual rows -->
    <xsl:for-each select="//cellstats[@type='cell_srviorq']/cells/cell[@name=$NAME_ALL]">
      <xsl:variable name="diskType">
        <xsl:value-of select="../@disk_type"/>
      </xsl:variable>
      <xsl:variable name="numCells">
        <xsl:value-of select="../@num_cells"/>
      </xsl:variable>
      <xsl:if test="substring($diskType,1,1) = $selectDiskTypeSubstr or ($diskType='PmemDisk' and substring($diskType,1,1) = 'X')">
        <tr class="exa">
          <td><xsl:value-of select="$diskType"/></td>
          <td align="right">
            <xsl:value-of select="$numCells"/>
          </td>
          <td align="right">
            <a href="#CELLSRV_IOPS_CELL">
              <xsl:apply-templates select="./stat[@name='srrq']/@tot" mode="number"/>
            </a>
          </td>
          <td align="right">
            <a href="#CELLSRV_IOPS_CELL">
              <xsl:call-template name="formatNumber">
                <xsl:with-param name="n" select="./stat[@name='srrq']/@tot div $numCells"/>
              </xsl:call-template>
            </a>
          </td>
          <td align="right">
            <a href="#CELLSRV_IOPS_CELL">
              <xsl:apply-templates select="./stat[@name='srrq']/@mean" mode="number"/>
            </a>
          </td>
          <td align="right">
            <a href="#CELLSRV_LATENCY_CELL">
              <xsl:apply-templates select="//cellstats[@type='cell_srvlatency']/cells[@disk_type=$diskType]/cell/stat[@name='sr']/@mean" mode="formatMs"/>
            </a>
          </td>
        </tr>
      </xsl:if>
    </xsl:for-each>
  </xsl:template>

  <!-- TEMPLATE for RAM cache small reads IOPs -->
  <xsl:template match="stat" mode="rc_small_reads">
    <!-- start row header -->
    <tr>
      <th class="exa">Small Reads - Memory Cache</th>
      <th class="exa"># Cells</th>
      <th class="exa">Total Small Reads/s</th>
      <th class="exa">Cell Small Reads/s</th>
    </tr>
    <xsl:variable name="numCells">
      <xsl:value-of select="../@num_cells"/>
    </xsl:variable>
    <tr class="exa">
      <td>Memory Cache</td>
      <td align="right"><xsl:value-of select="$numCells"/></td>
      <td align="right">
        <a href="#CELL_RAM_CACHE_UREADS">
          <xsl:apply-templates select="./@rqps" mode="number"/>
        </a>
      </td>
      <td align="right">
        <a href="#CELL_RAM_CACHE_UREADS">
          <xsl:call-template name="formatNumber">
            <xsl:with-param name="n" select="./@rqps div $numCells"/>
          </xsl:call-template>
        </a>
      </td>
    </tr>
  </xsl:template>

  <!-- TEMPLATE for flash cache db summary -->
  <xsl:template name="flashCacheDbSummary">
    <xsl:if test="$hasDbRqDetail = 'Y'">
      <p>Database Small IO Summary</p>
      <xsl:apply-templates select="//cellstats[@type='topdb']" mode="fc_summary"/>
    </xsl:if>
  </xsl:template>

  <xsl:template match="//cellstats[@type='topdb']" mode="fc_summary">
    <table class="exa" border="0" width="600" summary="This table displays database statistics for flash cache summary">
      <tr>
        <td></td>
        <th class="exa" colspan="3">Small Read Requests</th>
        <th class="exa" colspan="4">Small Read Latency</th>
      </tr>
      <tr>
        <th class="exa">Database Name</th>
        <th class="exa">per Second</th>
        <th class="exa">%Flash</th>
        <th class="exa">%Disk</th>
        <th class="exa">Flash Latency</th>
        <th class="exa">Disk Latency</th>
        <th class="exa">Flash Queue Time</th>
        <th class="exa">Disk Queue Time</th>
      </tr>
      <!-- get topN databases by requests -->
      <xsl:for-each select="./db">
        <xsl:sort select="./stat[@name='rq']/@rn" data-type="number"/>
        <xsl:if test="./stat[@name='rq']/@rn &lt;= $topDbs">
          <xsl:variable name="dbName" select="./@name"/>
          <tr class="exa">
            <td class="exabr">
              <a>
                <xsl:attribute name="href">
                  <xsl:value-of select="concat('#CELL_TOPDB_REQ_DETAIL-',$dbName)"/>
                </xsl:attribute>
                <xsl:value-of select="$dbName"/>
              </a>
            </td>
            <td align="right">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@psec" mode="number"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@fcpct" mode="number"/>
            </td>
            <td align="right" class="exabr">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@hdpct" mode="number"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@fclt" mode="formatMs"/>
            </td>
            <td align="right" class="exabr">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@hdlt" mode="formatMs"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@fcqt" mode="formatMs"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./stat[@name='rq']/rqs/rq[@type='small']/@hdqt" mode="formatMs"/>
            </td>
          </tr>
        </xsl:if>
      </xsl:for-each>
    </table>
  </xsl:template>

  <!-- TEMPLATE For flash cache scan summary -->
  <xsl:template name="flashCacheScanSummary">
    <!-- only display if we have the fc_ureads xml fragment -->
    <xsl:if test="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]">
      <p>Flash Cache Scan Summary</p>
      <xsl:variable name="fcScanAttempted">
        <xsl:value-of select="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]/stat[@name='fciordw']/@attps"/>
      </xsl:variable>
      <xsl:variable name="fcScanRead">
        <xsl:value-of select="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]/stat[@name='fciordw']/@mbps"/>
      </xsl:variable>
      <xsl:variable name="fcScanFlashReadPct">
        <xsl:value-of select="//cellstats[@type='fc_ureads']/cell[@name=$NAME_ALL]/stat[@name='fciordw']/@ratio"/>
      </xsl:variable>
      <!-- avoid negative numbers when computing disk I/O -->
      <xsl:variable name="fcScanDiskReadPct">
        <xsl:choose>
          <xsl:when test="$fcScanFlashReadPct &lt; 100">
            <xsl:value-of select="100 - $fcScanFlashReadPct"/>            
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="''"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <xsl:variable name="fcScanDisk">
        <xsl:choose>
          <xsl:when test="$fcScanAttempted &gt; $fcScanRead">
            <xsl:value-of select="$fcScanAttempted - $fcScanRead"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="''"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <table class="exa" border="0" width="600" summary="This table displays Flash Cache Scan Summary">
        <tr>
          <td></td>
          <th class="exa">%MB</th>
          <th class="exa">MB/s</th>
        </tr>
        <tr class="exa">
          <td>Flash</td>
          <td align="right">
            <xsl:call-template name="formatNumber">
              <xsl:with-param name="n" select="$fcScanFlashReadPct"/>
            </xsl:call-template>
          </td>
          <td align="right">
            <xsl:call-template name="formatNumber">
              <xsl:with-param name="n" select="$fcScanRead"/>
            </xsl:call-template>
          </td>
        </tr>
        <tr class="exa">
          <td>Disk</td>
          <td align="right">
            <xsl:call-template name="formatNumber">
              <xsl:with-param name="n" select="$fcScanDiskReadPct"/>
            </xsl:call-template>
          </td>
          <td align="right">
            <xsl:call-template name="formatNumber">
              <xsl:with-param name="n" select="$fcScanDisk"/>
            </xsl:call-template>
          </td>
        </tr>
      </table>
    </xsl:if>
  </xsl:template>

  <!-- template for flash cache temp summary -->
  <xsl:template name="flashCacheTempSummary">
    <p>Temp IO and Large Writes Summary</p>
    <ul>
      <li class="exa">direct path [read|write] temp wait time for the database, not restricted to an instance</li>
      <li class="exa">Large writes from the cells, not restricted to this database or instance</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary for direct path read/write to temp">
        <tr>
          <td></td>
          <td></td>
          <td></td>
          <td></td>
          <th class="exa" colspan="22">% of Total Waits</th>
        </tr>
        <tr>
          <td></td>
          <th class="exa">Total Waits</th>
          <th class="exa">FG Waits</th>
          <th class="exa">Avg Wait</th>
          <th class="exa">&lt;1us</th>
          <th class="exa">&lt;2us</th>
          <th class="exa">&lt;4us</th>
          <th class="exa">&lt;8us</th>
          <th class="exa">&lt;16us</th>
          <th class="exa">&lt;32us</th>
          <th class="exa">&lt;64us</th>
          <th class="exa">&lt;128us</th>
          <th class="exa">&lt;256us</th>
          <th class="exa">&lt;512us</th>
          <th class="exa">&lt;1ms</th>
          <th class="exa">&lt;2ms</th>
          <th class="exa">&lt;4ms</th>
          <th class="exa">&lt;8ms</th>
          <th class="exa">&lt;16ms</th>
          <th class="exa">&lt;32ms</th>
          <th class="exa">&lt;64ms</th>
          <th class="exa">&lt;128ms</th>
          <th class="exa">&lt;256ms</th>
          <th class="exa">&lt;512ms</th>
          <th class="exa">&lt;1s</th>
          <th class="exa">&gt;=1s</th>
        </tr>
        <xsl:apply-templates select="//cellstats[@type='fc_summary']/summary[@type='fc_temp']/waits/wait" mode="fctmp_summary"/>
    </table>
    <xsl:if test="$hasFlashCacheLW = 'Y'">
      <table class="exa" border="0" width="600" summary="This table contains flash cache performance summary for direct path read/write to temp">
        <tr>
          <th class="exa" colspan="4">Large Writes/s</th>
        </tr>
        <tr>
          <th class="exa">Total</th>
          <th class="exa">Temp Spill</th>
          <th class="exa">Data/Temp Tables</th>
          <th class="exa">Write Only</th>
        </tr>
          <xsl:apply-templates select="//cellstats[@type='fc_uwrites']/cell[@name='All']" mode="getLWTotalSummary"/>
      </table>
    </xsl:if>
  </xsl:template>

  <xsl:template match="wait" mode="fctmp_summary">
    <tr class="exa">
      <td nowrap="true"><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:apply-templates select="./@twt" mode="int"/></td>
      <td align="right"><xsl:apply-templates select="./@fgwt" mode="int"/></td>
      <td align="right">
        <xsl:attribute name="title">Total Time:<xsl:apply-templates select="./@fgtm" mode="formatMs"/>
        </xsl:attribute>
        <xsl:apply-templates select="./@avtm" mode="formatMs"/>
      </td>
      <xsl:call-template name="histogramLoop">
        <xsl:with-param name="type" select="'fc_temp'"/>
        <xsl:with-param name="wait" select="./@name"/>
        <xsl:with-param name="id" select="'1'"/>
      </xsl:call-template>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Configuration Sections                                       -->
  <!-- ============================================================ -->

  <!-- ============================================================ -->
  <!-- TEMPLATE for Configuration Make Model                        -->
  <xsl:template match="//configs[@type='makemodel']">
    <a name="CELL_STORAGE_SERVER_MODEL"/>
    <h3 class="exa">Exadata Storage Server Model</h3>
    <xsl:choose>
      <xsl:when test="./config">
        <ul>
          <li class="exa">Model Information of Servers</li>
          <li class="exa">CPU Count refers to logical CPUs, including cores and hyperthreads</li>
        </ul>
        <table border="0" class="exa" summary="This table displays Model Configuration of Exadata Cells">
          <tr>
            <th class="exa">Model</th>
            <th class="exa">CPU Count</th>
            <th class="exa">Memory (GB)</th>
            <th class="exa"># Cells</th>
            <th class="exa">Cells</th>
          </tr>
          <!-- actual data rows -->
          <xsl:apply-templates select="./config" mode="makemodel"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="config" mode="makemodel">
    <tr class="exa">
      <td><xsl:value-of select="./make"/></td>
      <td align="right"><xsl:value-of select="./cpu"/></td>
      <td align="right"><xsl:value-of select="./memory"/></td>
      <td align="right"><xsl:value-of select="./@count"/></td>
      <td>
        <xsl:call-template name="join">
          <xsl:with-param name="list" select="./cells/cell"/>
        </xsl:call-template>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- determine if we want to display 'All' or list of cells -->
  <xsl:template match="config" mode="list">
    <xsl:choose>
      <xsl:when test="./@cell_name and ./@cell_name = $NAME_ALL">
        <xsl:value-of select="concat($NAME_ALL,' (', ./@num_cells,')')"/>
      </xsl:when>
      <xsl:when test="./@cell_name and ./@cell_name = 'Total for all cells'">
        <xsl:value-of select="concat('Total (', ./@num_cells, ')')"/>
      </xsl:when>
      <!-- this is the 'All' node for storage information -->
      <xsl:when test="not(./@cell_name) and not(./cells)">
        <xsl:value-of select="concat($NAME_ALL,' (', ./@num_cells,')')"/>        
      </xsl:when>
      <xsl:otherwise>
        <xsl:variable name="cellList">
          <xsl:call-template name="join">
            <xsl:with-param name="list" select="./cells/cell"/>
          </xsl:call-template>
        </xsl:variable>
        <xsl:value-of select="concat('(',./@num_cells,'): ',$cellList)"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- ============================================================ -->
  <!-- TEMPLATE for Configuration Version                           -->
  <xsl:template match="//configs[@type='version']">
    <a name="CELL_STORAGE_SERVER_VERSION"/>
    <h3 class="exa">Exadata Storage Server Version</h3>
    <xsl:choose>
      <xsl:when test="./config">
        <ul>
          <li class="exa">Version information of packages on the storage server</li>
        </ul>
        <table border="0" class="exa" summary="This table displays Version Configuration of Exadata Cells">
          <tr>
            <th class="exa">Package Type</th>
            <th class="exa">Package Version</th>
            <th class="exa">Cells</th>
          </tr>
          <!-- actual data rows -->
          <xsl:apply-templates select="./config" mode="version"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="config" mode="version">
    <tr class="exa">
      <td>
        <xsl:choose>
          <xsl:when test="./@type='cell_version'">Cell</xsl:when>
          <xsl:when test="./@type='inf_version'">Infiniband</xsl:when>
          <xsl:when test="./@type='kernel'">Kernel</xsl:when>
          <xsl:when test="./@type='offload'">Offload</xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="./@type"/>
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td><xsl:value-of select="./@value"/></td>
      <td>
        <xsl:apply-templates select="." mode="list"/>
      </td>
    </tr>
  </xsl:template>

  <!-- storage information -->
  <xsl:template match="//configs[@type='storage']">
    <a name="CELL_STORAGE_INFORMATION"/>
    <h3 class="exa">Exadata Storage Information</h3>
    <xsl:choose>
      <xsl:when test="./config">
        <ul>
          <li class="exa">Storage information per cell</li>
          <li class="exa">'Total' is the sum for all cells</li>
        </ul>
        <xsl:variable name="colspan">
          <xsl:choose>
            <xsl:when test="$hasPmem = 'Y'">
              <xsl:value-of select="'3'"/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:value-of select="'2'"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:variable>
        <table border="0" class="exa" summary="This table displays storage information of Exadata Cells">
          <tr>
            <td></td><td></td><td></td>
            <th class="exa" colspan="{$colspan}"># Celldisks</th>
            <td></td><td></td>
          </tr>
          <tr>
            <th class="exa"># Cells</th>
            <th class="exa">Flash Cache Size (GB)</th>
            <th class="exa">Flash Log Size (GB)</th>
            <th class="exa">Hard Disk</th>
            <th class="exa">Flash</th>
            <xsl:if test="$hasPmem = 'Y'">
              <th class="exa">Persistent Memory</th>              
            </xsl:if>
            <th class="exa"># Griddisks</th>
            <th class="exa">Cell Name</th>
          </tr>
          <!-- actual data rows -->
          <xsl:apply-templates select="./config[not(@name)]" mode="storage"/>
          <!-- display total last -->
          <xsl:apply-templates select="./config[@name = 'Total for all cells']" mode="storage"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="config" mode="storage">
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@name = 'Total for all cells'">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td class="exabr">
        <xsl:choose>
          <xsl:when test="./@name = 'Total for all cells'">
            <xsl:value-of select="concat('Total (', ./@num_cells, ')')"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="./@num_cells"/>
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@cachesize" mode="number"/>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./@logsize" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@harddisks" mode="int"/>
      </td>
      <td align="right">
        <xsl:if test="$hasPmem = 'N'">
          <xsl:attribute name="class">
            <xsl:value-of select="'exabr'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:apply-templates select="./@flashdisks" mode="int"/>
      </td>
      <xsl:if test="$hasPmem = 'Y'">
        <td align="right" class="exabr">
          <xsl:apply-templates select="./@pmemdisks" mode="int"/>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./@griddisks" mode="int"/>
      </td>
      <td><xsl:apply-templates select="." mode="list"/></td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for griddisks                                       -->
  <xsl:template match="//configs[@type='griddisk']">
    <a name="CELL_GRIDDISK"/>
    <h3 class="exa">Exadata Griddisks</h3>
    <xsl:choose>
      <xsl:when test="./config">
        <ul>
          <li class="exa">Griddisks on the storage servervs</li>
          <li class="exa"><xsl:value-of select="$diskTypeMessageConfig"/></li>
          <li class="exa">Size (GB) - Griddisk: indicates size of individual Griddisks in the cells</li>
          <li class="exa">Size (GB) - Cell Total: indicates total size per cell</li>
          <li class="exa">Size (GB) - System Total: indicates total size over all cells</li>
        </ul>
        <table border="0" class="exa" summary="This table displays griddisk information of Exadata Cells">
          <tr>
            <td></td><td></td>
            <th class="exa" colspan="3">Size (GB)</th>
            <td></td><td></td>
          </tr>
          <tr>
            <th class="exa">Griddisk Name Prefix</th>
            <th class="exa"># Griddisks</th>
            <th class="exa">Griddisk</th>
            <th class="exa">Cell Total</th>
            <th class="exa">System Total</th>
            <th class="exa">Disk Type</th>
            <th class="exa">Cells</th>
          </tr>
          <!-- actual data rows -->
          <xsl:apply-templates select="./config" mode="griddisk"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="config" mode="griddisk">
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:value-of select="./@num_disks"/></td>
      <td align="right"><xsl:apply-templates select="./@size" mode="number"/></td>
      <td align="right">
        <xsl:call-template name="formatNumber">
          <xsl:with-param name="n" select="./@size * ./@num_disks"/>
        </xsl:call-template>
      </td>
      <td align="right">
        <xsl:call-template name="formatNumber">
          <xsl:with-param name="n" select="./@size * ./@num_disks * ./@num_cells"/>
        </xsl:call-template>
      </td>
      <td><xsl:value-of select="./@type"/></td>
      <td><xsl:apply-templates select="." mode="list"/></td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for celldisks                                       -->
  <xsl:template match="//configs[@type='celldisk']">
    <a name="CELL_CELLDISK"/>
    <h3 class="exa">Exadata Celldisks</h3>
    <xsl:choose>
      <xsl:when test="./config">
        <ul>
          <li class="exa">Celldisks on the storage servervs</li>
          <li class="exa"><xsl:value-of select="$diskTypeMessageConfig"/></li>
          <li class="exa">Celldisk Size indicates size of individual Celldisks in the cells, not the total size</li>
          <li class="exa">System disks have the same disk type, but are smaller in size</li>
        </ul>
        <table border="0" class="exa" summary="This table displays celldisk information of Exadata Cells">
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Celldisk Size (GB)</th>
            <th class="exa"># Celldisks</th>
            <th class="exa">Cells</th>
          </tr>
          <xsl:apply-templates select="./config" mode="celldisk"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="config" mode="celldisk">
    <tr class="exa">
      <td><xsl:value-of select="./@disk_type"/></td>
      <td align="right"><xsl:apply-templates select="./@disk_size" mode="number"/></td>
      <td align="right"><xsl:value-of select="./@num_disks"/></td>
      <td><xsl:apply-templates select="." mode="list"/></td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for ASM diskgroups  -->
  <xsl:template match="//configs[@type='asm_diskgroup']">
    <a name="ASM_DISKGROUP"/>
    <h3 class="exa">ASM Diskgroups</h3>
    <xsl:choose>
      <xsl:when test="./config">
        <ul>
          <li class="exa">ASM Diskgroups at the end of the report period for the database</li>
        </ul>
        <table border="0" class="exa" summary="This table displays ASM Diskgroups">
          <tr>
            <th class="exa">Disk Group</th>
            <th class="exa">Size (GB)</th>
            <th class="exa">Used (GB)</th>
            <th class="exa"># Griddisks</th>
            <th class="exa">Redundancy</th>
            <th class="exa">State</th>
            <xsl:if test="$hasMissingDisk = 'Y'">
              <th class="exa">Warning</th>
            </xsl:if>
          </tr>
          <xsl:apply-templates select="./config" mode="asm_diskgroup"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="config" mode="asm_diskgroup">
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:apply-templates select="./@total" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./@used" mode="number"/></td>
      <td align="right"><xsl:value-of select="./@disks"/></td>
      <td><xsl:value-of select="./@type"/></td>
      <td><xsl:value-of select="./@state"/></td>
      <xsl:if test="$hasMissingDisk = 'Y'">
        <td>
          <xsl:if test="./@missing_disk = 'Y'">
            <xsl:attribute name="class">
              <xsl:value-of select="'exawarn'"/>
            </xsl:attribute>Missing Griddisk
          </xsl:if>
        </td>
      </xsl:if>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- Health section                                               -->
  <!-- ============================================================ -->

  <!-- ============================================================ -->
  <!-- TEMPLATE for alerts summary                                  -->
  <xsl:template match="//cellstats[@type='alerts']">
    <a name="CELL_ALERTS_SUMMARY"/>
    <h3 class="exa">Exadata Alerts Summary</h3>
    <xsl:choose>
      <xsl:when test="./cells">
        <ul>
          <li class="exa">Number of open alerts at the end snapshot'</li>
          <li class="exa">Stateless alerts are restricted to those opened in the past 24 hours</li>
        </ul>
        <table border="0" class="exa" summary="This table displays a summary of the number of alerts that were open at the AWR end snapshot">
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">Critical</th>
            <th class="exa">Warning</th>
            <th class="exa">Info</th>
          </tr>
          <!-- first display total -->
          <tr class="exa">
            <td>Total</td>
            <td align="right">
              <xsl:apply-templates select="./cells/@tot" mode="int"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./cells/@crit" mode="int"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./cells/@warn" mode="int"/>
            </td>
            <td align="right">
              <xsl:apply-templates select="./cells/@info" mode="int"/>
            </td>
          </tr>
          <!-- now display individual cells -->
          <xsl:apply-templates select="./cells/cell" mode="alerts_summary"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p>No open alerts.</p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="alerts_summary">
    <tr class="exa">
      <td>
        <!-- create link to details -->
        <a>
          <xsl:attribute name="href">
            <xsl:value-of select="concat('#CELL_ALERTS_DETAIL_',./@name)"/>
          </xsl:attribute>
          <xsl:value-of select="./@name"/>
        </a>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@tot" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@crit" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@warn" mode="int"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@info" mode="int"/>
      </td>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for alert details                                   -->
  <xsl:template match="//cellstats[@type='alerts']/cells">
    <a name="CELL_ALERTS_DETAIL"/>
    <h3 class="exa">Exadata Alerts Detail</h3>
    <ul>
      <li class="exa">Number of open alerts at the end snapshot'</li>
      <li class="exa">only the 10 most recent open alerts per cell are displayed</li>
      <li class="exa">Stateless alerts are restricted to those opened in the past 24 hours</li>
      <li class="exa">ordered by Cell Name, Begin Time desc</li>
    </ul>
    <table border="0" class="exa" summary="This table displays the 10 most recent open alerts on each cell when for the AWR end snapshot">
      <tr>
        <th class="exa">Cell Name</th>
        <th class="exa">Alert Time</th>
        <th class="exa">Severity</th>
        <th class="exa">Stateful</th>
        <th class="exa">Message</th>
      </tr>
      <!-- individual rows -->
      <xsl:apply-templates select="./cell" mode="alerts_detail"/>
    </table>
  </xsl:template>

  <xsl:template match="cell" mode="alerts_detail">
    <!-- first row display the cell name -->
    <xsl:variable name="cellName" select="./@name"/>
    <xsl:apply-templates select="./alert" mode="alerts_detail">
      <xsl:with-param name="cellName" select="$cellName"/>
    </xsl:apply-templates>
  </xsl:template>

  <xsl:template match="alert" mode="alerts_detail">
    <xsl:param name="cellName"/>
    <tr class="exa">
      <td>
        <!-- only display cellname for first alert -->
        <xsl:if test="position() = 1">
          <!-- drop anchor -->
          <a>
            <xsl:attribute name="name">
              <xsl:value-of select="concat('CELL_ALERTS_DETAIL_',$cellName)"/>
            </xsl:attribute>
          </a>
          <xsl:value-of select="$cellName"/>
        </xsl:if>
      </td>
      <!-- display alert details -->
      <td><xsl:value-of select="./@begin_time"/></td>
      <td><xsl:value-of select="./@severity"/></td>
      <td><xsl:value-of select="./@state"/></td>
      <td><xsl:value-of select="."/></td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for offline disks                                   -->
  <xsl:template match="//cellstats[@type='offline_disks']">
    <a name="CELL_OFFLINE_DISKS"/>
    <h3 class="exa">Exadata Non-Online Disks</h3>
    <xsl:choose>
      <xsl:when test="./disk">
        <ul>
          <li class="exa">ASM Disks that were not online at the end of the report period</li>
        </ul>
        <table border="0" class="exa" summary="This table displays ASM disks that were not online at the end of the report period">
          <tr>
            <th class="exa">Disk Name</th>
            <th class="exa">Status</th>
          </tr>
          <xsl:apply-templates select="./disk" mode="offline_disks"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p>All disks were online at the end of the report period.</p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="offline_disks">
    <!-- for offline disks, always mark it as red -->
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td class="exawarn"><xsl:value-of select="./@status"/></td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- IO Latency capping                                           -->

  <xsl:template match="//cellstats[@type='io_capping_db']">
    <a name="CELL_IO_CAPPING_DB"/>
    <h4 class="exa">Database Cancelled IOs</h4>
    <xsl:choose>
      <xsl:when test="./inst">
        <ul>
          <li class="exa">The cancelled IOs are collected by System Statistics as 'cell num map elem cancellation'</li>
          <li class="exa">These are IOs cancelled by the cells that were issued by this database</li>
        </ul>
        <table class="exa" border="0" width="500" summary="This table displays IO latency capping information">
          <tr>
            <th class="exa">Inst#</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
          </tr>
          <xsl:apply-templates select="./inst" mode="io_capping_db"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="inst" mode="io_capping_db">
    <tr class="exa">
      <td>
        <xsl:choose>
          <xsl:when test="./@id = $NAME_ALL">*</xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="./@id"/>
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td align="right"><xsl:apply-templates select="./@value" mode="int"/></td>
      <td align="right"><xsl:apply-templates select="./@psec" mode="number"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="//cellstats[@type='io_capping']">
    <a name="CELL_IO_CAPPING_EXA"/>
    <h4 class="exa">Cancelled IOs - Cells</h4>
    <xsl:choose>
      <xsl:when test="./cell">
        <ul>
          <li class="exa">Disk Failure - IOs were stuck and cancelled due to disk failure</li>
          <li class="exa">Reads - cancelled reads due to possible disk failure (hair trigger)</li>
          <li class="exa">Writes - cancelled writes due to possible disk failure (hair trigger)</li>
          <li class="exa">Unsubmitted - IOs were cancelled before reaching the OS</li>
          <li class="exa">%Cancellable - IOs cancelled for the specified reason as a percentage of Cancellable IOs</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays IO latency capping information">
          <tr>
            <td></td>
            <th class="exa" colspan="4">Total IOs</th>
            <th class="exa" colspan="8">Cancel Reasons</th>
          </tr>
          <tr>
            <td></td>
            <th class="exa" colspan="2">Cancellable</th>
            <th class="exa" colspan="2">Non-Cancellable</th>
            <th class="exa" colspan="2">Disk Failure</th>
            <th class="exa" colspan="2">Reads</th>
            <th class="exa" colspan="2">Writes</th>
            <th class="exa" colspan="2">Unsubmitted</th>
          </tr>
          <tr>
            <th class="exa">Cell Name</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">per Sec</th>
            <th class="exa">Total</th>
            <th class="exa">%Cancellable</th>
            <th class="exa">Total</th>
            <th class="exa">%Cancellable</th>
            <th class="exa">Total</th>
            <th class="exa">%Cancellable</th>
            <th class="exa">Total</th>
            <th class="exa">%Cancellable</th>
          </tr>
          <xsl:apply-templates select="./cell" mode="io_capping"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="io_capping">
    <tr class="exa">
      <td><xsl:apply-templates select="./@name" mode="allToTotal"/>
       <xsl:if test="./@name = $NAME_ALL">
        <xsl:value-of select="concat(' (',./@num_cells,')')"/>
      </xsl:if>
      </td>
      <td align="right"><xsl:apply-templates select="./stat[@name='ioc']/@value" mode="int"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='ioc']/@psec" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='ionc']/@value" mode="int"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='ionc']/@psec" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iocc']/@value" mode="int"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='iocc']/@pct" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='ioccr']/@value" mode="int"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='ioccr']/@pct" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='ioccw']/@value" mode="int"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='ioccw']/@pct" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iocos']/@value" mode="int"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='iocos']/@pct" mode="number"/></td>
    </tr>
  </xsl:template>

  <xsl:template match="//cellstats[@type='io_capping_asm']">
    <a name="CELL_IO_CAPPING_ASM"/>
    <h4 class="exa">Cancelled IOs - Client</h4>
    <xsl:choose>
      <xsl:when test="./group">
        <ul>
          <li class="exa">client (ASM) IOs cancelled or timed out</li>
        </ul>
        <table class="exa" border="0" width="800" summary="This table displays IO latency capping information for the client">
          <tr>
            <td></td>
            <th class="exa" colspan="4">Cancelled IOs</th>
          </tr>
          <tr>
            <th class="exa">Disk Group</th>
            <th class="exa">Reads</th>
            <th class="exa">Reads per Sec</th>
            <th class="exa">Writes</th>
            <th class="exa">Writes per Sec</th>
          </tr>
          <xsl:apply-templates select="./group" mode="io_capping"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="group" mode="io_capping">
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='rto']/@value" mode="integer"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='rto']/@psec" mode="number"/></td>
      <td align="right"><xsl:apply-templates select="./stat[@name='wto']/@value" mode="integer"/></td>
      <td align="right" class="exabr"><xsl:apply-templates select="./stat[@name='wto']/@psec" mode="number"/></td>
    </tr>
  </xsl:template>

</xsl:stylesheet>


OHA YOOOO