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/exadataDiffHtml.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" select="'All'"/>
  <xsl:variable name="NONE" select="''"/>

  <!-- 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="UNIT_MS">
    <xsl:value-of select="'ms'"/>
  </xsl:variable>
  <xsl:variable name="UNIT_US">
    <xsl:value-of select="'us'"/>
  </xsl:variable>
  <xsl:variable name="UNIT_NS">
    <xsl:value-of select="'ns'"/>
  </xsl:variable>
  <xsl:variable name="UNIT_S">
    <xsl:value-of select="'s'"/>
  </xsl:variable>

  <!-- global variables -->
  <!-- metadata for top n reasons and databases -->
  <xsl:variable name="topReason" select="//tops/ioreason/@topn"/>
  <xsl:variable name="pctReason" select="//tops/ioreason/@pct"/>
  <xsl:variable name="topDbs" select="//tops/dbs/@topn"/>
  <xsl:variable name="topDbPerCell" select="//tops/dbs/@percell"/>
  <!-- no data message for empty sections -->
  <xsl:variable name="noDataMsg" select="'No data exists for this section of the report.'"/>

  <!-- message for insufficient interval for displaying resource stats -->
  <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>

  <!-- whether or not to show partial writes for FC User writes -->
  <!-- we only show if both reqs and mbs are non-zero           -->
  <!-- this should be rare so we do not want to show it in the normal case -->
  <xsl:variable name="showPartialWrites">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_uwrites']/cells/cell[@rank='0']/stat[@name='fciowp']/period/@rqps &gt; 0 and //cellstats[@type='dd_fc_uwrites']/cells/cell[@rank='0']/stat[@name='fciowp']/period/@mbps &gt; 0">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="showDiskWriter">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_ireads']/cells/cell[@rank='0']/stat[@name='fciordkwr'] or //cellstats[@type='dd_fc_ireads']/cells/cell[@rank='0']/stat[@name='fciowdkwr']">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="showFcTrims">
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_iwrites']/cells/cell[@rank='0']/stat[@name='fciowtrim']">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="hasMissingDisk">
    <xsl:choose>
      <xsl:when test="//configs[@type='dd_asm_diskgroup']/config/period[@missing_disk='Y']">
        <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='dd_rc_ureads']/cells or 
      //cellstats[@type='dd_rc_iwrites']/cells or
      //cellstats[@type='dd_rc_scp']/cells">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <xsl:variable name="hasPmem">
    <xsl:choose>
      <xsl:when test="//configs[@type='dd_storage']/config[@pmemdisks] and //configs[@type='dd_storage']/config/@pmemdisks &gt; 0">
        <xsl:value-of select="'Y'"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="'N'"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:variable>

  <!-- 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'"/>


  <!-- TODO: move to an exadataUtilHtml.xsl -->

  <!-- ============================================================ -->
  <!-- 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>


  <!-- ========================================================== -->
  <!-- match any attribute and format it as a number              -->
  <xsl:template match="@*" mode="number">
    <xsl:param name="decimalPoints" select="'Y'"/>
    <xsl:param name="blankToZero" select="'N'"/>
    <xsl:param name="zeroToBlank" select="'N'"/>
    
    <xsl:choose>
      <xsl:when test=". and . = 0 and $zeroToBlank = 'Y'">
        <xsl:value-of select="''"/>
      </xsl:when>
      <xsl:when test=". and . != '' and $decimalPoints='Y'">
        <xsl:value-of select="format-number(number(.),'##,###,##0.00')"/>
      </xsl:when>
      <xsl:when test=". and . != '' and $decimalPoints='N'">
        <xsl:value-of select="format-number(number(.),'##,###,##0')"/>
      </xsl:when>
      <xsl:when test="(. = '' or . = 0) and $blankToZero = 'Y' and $decimalPoints='Y'">
        <xsl:value-of select="'0.00'"/>
      </xsl:when>
      <xsl:when test="(. = '' or . = 0) and $blankToZero = 'Y' and $decimalPoints='N'">
        <xsl:value-of select="'0'"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <!-- ========================================================== -->
  <!-- NAME: formatMs                                             -->
  <!-- DESCRIPTION: converts ms to either s, ms, us or ns         -->
  <!--              appends unit to display                       -->
  <!-- ========================================================== -->
  <xsl:template name="formatMs">
    <xsl:param name="n"/>
    <xsl:param name="toUnit" select="''"/>

    <xsl:variable name="newUnit">
      <xsl:choose>
        <xsl:when test="$toUnit = ''">
          <xsl:call-template name="getMsUnit">
            <xsl:with-param name="n" select="$n"/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$toUnit"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$newUnit = $UNIT_MS">
        <xsl:value-of select="concat(format-number($n,'##,###,##0.00'),'ms')"/>
      </xsl:when>
      <xsl:when test="$newUnit = $UNIT_US">
        <xsl:value-of select="concat(format-number($n * 1000,'##,###,##0.00'),'us')"/>
      </xsl:when>
      <xsl:when test="$newUnit = $UNIT_NS">
        <xsl:value-of select="concat(format-number($n * 1000000,'##,###,##0.00'),'ns')"/>
      </xsl:when>
      <xsl:when test="$newUnit = $UNIT_S">
        <xsl:value-of select="concat(format-number($n div 1000,'##,###,##0.00'),'s')"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="@*" mode="ms">
    <xsl:param name="toUnit" select="$UNIT_NONE"/>
    <xsl:variable name="newUnit">
      <xsl:choose>
        <xsl:when test="$toUnit = $UNIT_NONE">
          <xsl:call-template name="getMsUnit">
            <xsl:with-param name="n" select="."/>
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$toUnit"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="n">
      <xsl:value-of select="number(.)"/>
    </xsl:variable>
    <xsl:choose>
      <xsl:when test="$newUnit = $UNIT_MS">
        <xsl:value-of select="concat(format-number($n,'##,###,##0.00'),'ms')"/>
      </xsl:when>
      <xsl:when test="$newUnit = $UNIT_US">
        <xsl:value-of select="concat(format-number($n * 1000,'##,###,##0.00'),'us')"/>
      </xsl:when>
      <xsl:when test="$newUnit = $UNIT_NS">
        <xsl:value-of select="concat(format-number($n * 1000000,'##,###,##0.00'),'ns')"/>
      </xsl:when>
      <xsl:when test="$newUnit = $UNIT_S">
        <xsl:value-of select="concat(format-number($n div 1000,'##,###,##0.00'),'s')"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="concat(format-number($n, '##,###,##0.00'),'ms')"/>
      </xsl:otherwise>
    </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 name="getMsUnit">
    <xsl:param name="n"/>
    <xsl:choose>
      <xsl:when test="number($n) &lt;= 0.000950">
        <xsl:value-of select="$UNIT_NS"/>
      </xsl:when>
      <xsl:when test="number($n) &lt;= 0.950">
        <xsl:value-of select="$UNIT_US"/>
      </xsl:when>
      <xsl:when test="number($n) &gt; 9500">
        <xsl:value-of select="$UNIT_S"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$UNIT_MS"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="@*" mode="getMsUnit">
    <xsl:choose>
      <xsl:when test="number(.) &lt;= 0.000950">
        <xsl:value-of select="$UNIT_NS"/>
      </xsl:when>
      <xsl:when test="number(.) &lt;= 0.950">
        <xsl:value-of select="$UNIT_US"/>
      </xsl:when>
      <xsl:when test="number(.) &gt; 9500">
        <xsl:value-of select="$UNIT_S"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$UNIT_MS"/>
      </xsl:otherwise>
    </xsl:choose>
  </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>

  <!-- ============================================================ -->
  <!-- functions for determining unit for time display s,ms,us,ns   -->

  <!-- ============================================================ -->
  <!-- TEMPLATE for displaying Resource Statistics TOC              -->
  <!-- ============================================================ -->
  <xsl:template name="resourceStatisticsToc">
    <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_OS_TOP"><xsl:value-of select="$titleExaOsTopStat"/></a></li>
       <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>

      <li><a class="exa" href="#CELL_SERVER_TOP"><xsl:value-of select="$titleExaCellSrvTopStat"/></a></li>
       <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>
    </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>
      <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_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_MB_CELL">Top Databases by Throughput per Cell</a></li>
    </ul>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- main html 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    -->
        <!-- in bullet points when using chrome browser           -->
        <!-- effect: delayed styling until entire page is loaded  -->
        <xsl:when test="/report/toc">
          <a name="CELL_DIFF"/>
          <h2 class="awr">Exadata Configuration and Statistics</h2>
          <ul class="exa">
            <li><a class="exa" href="#CELL_CONFIGURATION">Exadata Server Configuration</a></li>
            <!-- add alerts and stats -->
            <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 Compare Period 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>
          </head>
              
          <body class="exa" bgcolor="#FFFFFF">
            <!-- configuration sections -->
            <a name="CELL_CONFIGURATION"/>
            <h2 class="exa">Exadata Server Configuration</h2>
            <ul class="exa">
              <li><a class="exa" href="#CELL_CONFIG_SUMMARY">Exadata Server Configuration Summary</a></li>
              <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='dd_config_summary']"/>
            <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>

            <xsl:apply-templates select="//configs[@type='dd_makemodel']"/>
            <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
    
            <xsl:apply-templates select="//configs[@type='dd_version']"/>
            <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
    
            <xsl:apply-templates select="//configs[@type='dd_storage']"/>
            <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
    
            <xsl:apply-templates select="//configs[@type='dd_griddisk']"/>
            <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
    
            <xsl:apply-templates select="//configs[@type='dd_celldisk']"/>
            <br/><a class="exa" href="#CELL_CONFIGURATION">Back to Exadata Server Configuration</a>
    
            <xsl:apply-templates select="//configs[@type='dd_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>
            
            <xsl:apply-templates select="//cellstats[@type='dd_alerts']"/>
            <br/><a class="exa" href="#CELL_HEALTH">Back to Exadata Server Health Report</a>

            <xsl:apply-templates select="//cellstats[@type='dd_alerts']/cells[@type='alerts']"/>
            <!-- in case we have no alerts, still display the section -->
            <xsl:if test="not(//cellstats[@type='dd_alerts']/cells[@type='alerts'])">
              <xsl:call-template name="noAlertDetails"/>
            </xsl:if>
            <br/><a class="exa" href="#CELL_HEALTH">Back to Exadata Server Health Report</a>

            <xsl:apply-templates select="//cellstats[@type='dd_offline_disks']"/>
            <br/><a class="exa" href="#CELL_HEALTH">Back to Exadata Server Health Report</a>

            <!-- Statistics sections -->
            <a name="CELL_STATISTICS"/>
            <h2 class="exa">Exadata Statistics</h2>
            <ul class="exa">
              <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: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>

            </ul>

            <!-- resource statistics toc -->
            <a name="CELL_RESOURCE_STATISTICS"/>
            <h3 class="exa"><xsl:value-of select="$titleExaResourceStat"/></h3>
            <xsl:choose>
              <xsl:when test="$minReportIntervalMsg ='N'">
                <xsl:call-template name="resourceStatisticsToc"/>
              </xsl:when>
              <xsl:otherwise>
                <p><xsl:value-of select="$minReportIntervalMsg"/></p>
              </xsl:otherwise>
            </xsl:choose>

            <!-- 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 Statistics</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 class="exa"><a class="exa" href="#OS_CPU_CELL_TOP">Exadata OS CPU Statistics - Top Cells</a></li>
            </ul>
            <!-- templates for displaying individual OS top sections -->
            <h3 class="exa">Exadata OS IO Statistics</h3>
            <p><xsl:apply-templates select="//cellstats[@type='dd_cell_osstat']" mode="top"/></p>
            <p><xsl:apply-templates select="//cellstats[@type='dd_disk_osstat']" mode="top"/></p>
          <br/><a class="exa" href="#CELL_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>

            <h3 class="exa">Exadata OS IO Latency</h3>
            <p><xsl:apply-templates select="//cellstats[@type='dd_cell_latency']" mode="top"/></p>
            <p><xsl:apply-templates select="//cellstats[@type='dd_disk_latency']" mode="top"/></p>
            <br/><a class="exa" href="#CELL_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>

            <p><xsl:apply-templates select="//cellstats[@type='dd_cpustat']" mode="top"/></p>
            <br/><a class="exa" href="#CELL_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>
            <!-- templates for displaying cellsrv top sections  -->
            <h3 class="exa">Cell Server IOPS Statistics</h3>
            <xsl:apply-templates select="//cellstats[@type='dd_cell_srviorq']" mode="top"/>
            <xsl:apply-templates select="//cellstats[@type='dd_disk_srviorq']" mode="top"/>

            <br/><a class="exa" href="#CELL_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>

            <h3 class="exa">Cell Server IO MB/s Statistics</h3>
            <xsl:apply-templates select="//cellstats[@type='dd_cell_srviomb']" mode="top"/>
            <xsl:apply-templates select="//cellstats[@type='dd_disk_srviomb']" mode="top"/>
            <br/><a class="exa" href="#CELL_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>

            <h3 class="exa">Cell Server IO Latency</h3>
            <xsl:apply-templates select="//cellstats[@type='dd_cell_srvlatency']" mode="top"/>
            <xsl:apply-templates select="//cellstats[@type='dd_disk_srvlatency']" mode="top"/>

            <br/><a class="exa" href="#CELL_STATISTICS">Back to <xsl:value-of select="$titleExaResourceStat"/></a>

            <!-- Smart IO sections -->
          <a name="CELL_SMART_STATISTICS"/>
          <h3 class="exa">Exadata Smart Statistics</h3>
          <xsl:call-template name="smartIoToc"/>
          <p><xsl:apply-templates select="//cellstats[@type='dd_smart_io']" mode="top"/></p>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <p><xsl:apply-templates select="//cellstats[@type='dd_flash_log']" mode="top"/></p>
          <br/><a class="exa" href="#CELL_SMART_STATISTICS">Back to Exadata Smart Statistics</a>
          <a name="CELL_FLASH_CACHE"/>
          <h3 class="exa">Flash Cache</h3>
          <ul class="exa">
            <xsl:if test="//config[@type='dd_fc']">
              <li><a class="exa" href="#CELL_FLASH_CACHE_CONFIG">Flash Cache Configuration</a></li>
            </xsl:if>
            <!-- FUTURE TODO
            <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_FLASH_CACHE_UWRITES">Flash Cache User Writes</a></li>
            <li><a class="exa" href="#CELL_FLASH_CACHE_UWRITES_LW">Flash Cache User Writes - Large Writes</a></li>
            <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>
            <!-- FUTURE TODO - as required
            <li><a class="exa" href="#CELL_FLASH_CACHE_SCAN_POP">Flash Cache Scan Population</a></li>
             -->
          </ul>
          <!-- templates for displaying flash cache sections -->
          <!-- note, flash cache may not have the cellstats[@type] at all -->
          <!-- so we explicitly check for non-existence to display the    -->
          <!-- header                                                     -->
          <p><xsl:apply-templates select="//config[@type='dd_fc']" mode="top"/></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='dd_fc_ureads']" mode="top"/></p>
          <xsl:if test="not(//cellstats[@type='dd_fc_ureads'])">
            <a name="CELL_FLASH_CACHE_UREADS"/>
            <h4 class="exa">Flash Cache User Reads</h4>
            <p><xsl:value-of select="$noDataMsg"/></p>
          </xsl:if>
          <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>
          <!-- user reads efficiency -->
          <p><xsl:apply-templates select="//cellstats[@type='dd_fc_ureads']" mode="eff"/></p>
          <xsl:if test="not(//cellstats[@type='dd_fc_ureads'])">
            <a name="CELL_FLASH_CACHE_UREADS_EFF"/>
            <h4 class="exa">Flash Cache Efficiency</h4>
            <p><xsl:value-of select="$noDataMsg"/></p>
          </xsl:if>
          <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>

          <!-- user writes -->
          <p><xsl:apply-templates select="//cellstats[@type='dd_fc_uwrites']" mode="top"/></p>
          <xsl:if test="not(//cellstats[@type='dd_fc_uwrites'])">
            <a name="CELL_FLASH_CACHE_UWRITES"/>
            <h4 class="exa">Flash Cache User Writes</h4>
            <p><xsl:value-of select="$noDataMsg"/></p>
          </xsl:if>
          <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>
          <!-- user writes - large writes -->
          <xsl:if test="not(//cellstats[@type='dd_fc_uwrites'])">
            <a name="CELL_FLASH_CACHE_UWRITES_LW"/>
            <h4 class="exa">Flash Cache User Writes - Large Writes</h4>
            <p><xsl:value-of select="$noDataMsg"/></p>
          </xsl:if>
          <p><xsl:apply-templates select="//cellstats[@type='dd_fc_uwrites']" mode="top_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>

          <!-- internal reads -->
          <p><xsl:apply-templates select="//cellstats[@type='dd_fc_ireads']" mode="top"/></p>
          <xsl:if test="not(//cellstats[@type='dd_fc_ireads'])">
            <a name="CELL_FLASH_CACHE_IREADS"/>
            <h4 class="exa">Flash Cache Internal Reads</h4>
            <p><xsl:value-of select="$noDataMsg"/></p>
          </xsl:if>
          <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>

          <!-- internal writes -->
          <p><xsl:apply-templates select="//cellstats[@type='dd_fc_iwrites']" mode="top"/></p>
          <xsl:if test="not(//cellstats[@type='dd_fc_iwrites'])">
            <a name="CELL_FLASH_CACHE_IWRITES"/>
            <h4 class="exa">Flash Cache Internal Writes</h4>
            <p><xsl:value-of select="$noDataMsg"/></p>
          </xsl:if>
          <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>

          <!-- 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='dd_rc_spc']" mode="top"/></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='dd_rc_ureads']" mode="top"/></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='dd_rc_iwrites']" mode="top"/></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>

          <!-- IO reason -->
          <a name="CELL_IOREASON"/>
          <h3 class="exa">Exadata IO Reasons</h3>
          <xsl:call-template name="ioReasonToc"/>
          <p><xsl:apply-templates select="//cellstats[@type='dd_ioreason_rq']" mode="top"/></p>
          <a class="exa" href="#CELL_IOREASON">Back to Exadata IO Reasons</a>
          <p><xsl:apply-templates select="//cellstats[@type='dd_ioreason_mb']" mode="top"/></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 Consumers -->
          <a name="CELL_TOPDB"/>
          <h3 class="exa">Exadata Top Database Consumers</h3>
          <xsl:call-template name="topDbConsumerToc"/>
          <p><xsl:apply-templates select="//cellstats[@type='dd_topdb_rq']" mode="top"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <p><xsl:apply-templates select="//cellstats[@type='dd_topdb_mb']" mode="top"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <p><xsl:apply-templates select="//cellstats[@type='dd_dbpercell_rq']" mode="top"/></p>
          <a class="exa" href="#CELL_TOPDB">Back to Exadata Top Database Consumers</a>
          <p><xsl:apply-templates select="//cellstats[@type='dd_dbpercell_mb']" mode="top"/></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>
          </body>
        </xsl:otherwise>
      </xsl:choose>
    </html>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- config section helper templates -->

  <!-- matches any attribute in cells and formats it as a number -->
  <xsl:template match="cells/@*" mode="list">
    <td align="right">
      <xsl:apply-templates select="." mode="number">
        <xsl:with-param name="decimalPoints" select="'N'"/>
        <xsl:with-param name="zeroToBlank" select="'Y'"/>
      </xsl:apply-templates>
    </td>
  </xsl:template>
  
  <!-- matches cells and displays # of cells and list of cells or 'All' -->
  <xsl:template match="cells" mode="list">
    <xsl:param name="attrName" select="'num_cells'"/>
    <xsl:if test="not(./@*[local-name() = $attrName])">
      <td></td>
    </xsl:if>
    <xsl:apply-templates select="./@*[local-name() = $attrName]" mode="list"/>
    <td class="exabr">
      <xsl:choose>
        <xsl:when test="./@cellname = $NAME_ALL">
          <xsl:value-of select="./@cellname"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="join">
            <xsl:with-param name="list" select="./cell"/>
            <xsl:with-param name="separator" select="', '"/>
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Config Summary                                 -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_config_summary']">
    <a name="CELL_CONFIG_SUMMARY"/>
    <h3 class="exa">Exadata Server Configuration Summary</h3>
    <ul>
      <li class="exa">The values below show the totals of the systems being compared</li>
    </ul>
    <table class="exa" border="0" width="600" summary="This table displays Exadata Configuration Summary">
      <tr>
        <th class="exa">Configuration</th>
        <th class="exa">1st</th>
        <th class="exa">2nd</th>
      </tr>
      <xsl:apply-templates select="//configs[@type='dd_config_summary']/config"/>
    </table>
  </xsl:template>
  
  <!-- individual rows -->
  <xsl:template match="//configs[@type='dd_config_summary']/config">

    <xsl:variable name="decimalPoints">
      <xsl:choose>
        <xsl:when test="contains(./@name ,'GB')">
          <xsl:value-of select="'Y'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'N'"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right">
        <xsl:apply-templates select="./@v1" mode="number">
          <xsl:with-param name="decimalPoints" select="$decimalPoints"/>
          <xsl:with-param name="zeroToBlank" select="'Y'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@v2" mode="number">
          <xsl:with-param name="decimalPoints" select="$decimalPoints"/>
          <xsl:with-param name="zeroToBlank" select="'Y'"/>
        </xsl:apply-templates>
      </td>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Storage Server Model                            -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_makemodel']">
    <a name="CELL_STORAGE_SERVER_MODEL"/>
    <h3 class="exa">Exadata Storage Server Model</h3>
    <table class="exa" border="0" width="600" summary="This table displays Exadata Storage Server Model">
      <col width="500"/>
      <tr class="exa">
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <th class="exa" colspan="2">1st</th>
        <th class="exa" colspan="2">2nd</th>
      </tr>
      <tr class="exa">
        <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>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
      </tr>
      <!-- now display information per config -->
      <xsl:apply-templates select="./config" mode="diff_makemodel"/>
    </table>
  </xsl:template>

  <xsl:template match="config" mode="diff_makemodel">
    <tr class="exa">
      <td nowrap="true"><xsl:value-of select="./make"/></td>
      <td align="right"><xsl:value-of select="./cpu"/></td>
      <td class="exabr" align="right"><xsl:value-of select="./memory"/></td>
      <xsl:if test="not(./cells[@id = '1'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='1']" mode="list">
        <xsl:with-param name="attrName" select="'cnt'"/>
      </xsl:apply-templates>
      <xsl:if test="not(./cells[@id = '2'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='2']" mode="list">
        <xsl:with-param name="attrName" select="'cnt'"/>        
      </xsl:apply-templates>
    </tr>
  </xsl:template>

>  <!-- ============================================================ -->
  <!-- TEMPLATE for Storage Server Version                          -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_version']">
    <a name="CELL_STORAGE_SERVER_VERSION"/>
    <h3 class="exa">Exadata Storage Server Version</h3>
    <table class="exa" border="0" width="600" summary="This table displays Exadata Storage Server Version">
      <tr class="exa">
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <th class="exa" colspan="2">1st</th>
        <th class="exa" colspan="2">2nd</th>
      </tr>
      <tr class="exa">
        <th class="exa">Package Type</th>
        <th class="exa">Package Version</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
      </tr>
      <!-- now display information per config -->
      <xsl:apply-templates select="./config" mode="diff_version"/>
    </table>
  </xsl:template>

  <xsl:template match="config" mode="diff_version">
    <tr class="exa">
      <xsl:variable name="packageType" select="./@type"/>
      <xsl:variable name="packageString">
        <xsl:choose>
          <xsl:when test="$packageType = 'cell_version'">
            <xsl:value-of select="'Cell'"/>
          </xsl:when>
          <xsl:when test="$packageType = 'inf_version'">
            <xsl:value-of select="'Infiniband'"/>
          </xsl:when>
          <xsl:when test="$packageType = 'kernel'">
            <xsl:value-of select="'Kernel'"/>
          </xsl:when>
          <xsl:when test="$packageType = 'offload'">
            <xsl:value-of select="'Offload'"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$packageType"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      <td><xsl:value-of select="$packageString"/></td>
      <td class="exabr"><xsl:value-of select="./@value"/></td>
      <xsl:if test="not(./cells[@id='1'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='1']" mode="list"/>
      <xsl:if test="not(./cells[@id='2'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='2']" mode="list"/>
    </tr>

  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for Storage Information                             -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_storage']">
    <a name="CELL_STORAGE_INFORMATION"/>
    <h3 class="exa">Exadata Storage Information</h3>
    <table class="exa" border="0" width="600" summary="This table displays Exadata Storage Information">
      <tr class="exa">
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <xsl:choose>
          <xsl:when test="$hasPmem = 'Y'">
            <th class="exa" colspan="3">#Celldisks</th>
          </xsl:when>
          <xsl:otherwise>
            <th class="exa" colspan="2">#Celldisks</th>            
          </xsl:otherwise>
        </xsl:choose>
        <td bgColor="White"></td>
        <th class="exa" colspan="2">1st</th>
        <th class="exa" colspan="2">2nd</th>
      </tr>
      <tr class="exa">
        <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 Disk</th>
        <xsl:if test="$hasPmem = 'Y'">
          <th class="exa">Persistent Memory</th>
        </xsl:if>
        <th class="exa"># Griddisks</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
      </tr>
      <!-- now display information per config -->
      <xsl:apply-templates select="./config" mode="diff_storage"/>
    </table>
  </xsl:template>

  <xsl:template match="config" mode="diff_storage">
    <tr class="exa">
      <td align="right">
        <xsl:apply-templates select="./@cachesize" mode="number"/>
      </td>
      <td class="exabr" align="right">
        <xsl:apply-templates select="./@logsize" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@harddisks" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </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="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>          
        </xsl:apply-templates>
      </td>
      <xsl:if test="$hasPmem = 'Y'">
        <td class="exabr" align="right">
          <xsl:apply-templates select="./@pmemdisks" mode="number">
            <xsl:with-param name="decimalPoints" select="'N'"/>          
          </xsl:apply-templates>
        </td>
      </xsl:if>
      <td class="exabr" align="right">
        <xsl:apply-templates select="./@griddisks">
          <xsl:with-param name="decimalPoints" select="'N'"/>          
        </xsl:apply-templates>
      </td>
      <xsl:if test="not(./cells[@id='1'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='1']" mode="list"/>
      <xsl:if test="not(./cells[@id='2'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='2']" mode="list"/>
    </tr>

  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Griddisks                                       -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_griddisk']">
    <a name="CELL_GRIDDISK"/>
    <h3 class="exa">Exadata Griddisks</h3>
    <table class="exa" border="0" width="600" summary="This table displays Exadata Griddisk Information">
      <tr class="exa">
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <th class="exa" colspan="2">1st</th>
        <th class="exa" colspan="2">2nd</th>
      </tr>
      <tr class="exa">
        <th class="exa">Griddisk Name Prefix</th>
        <th class="exa"># Griddisks</th>
        <th class="exa">Griddisk Size (GB)</th>
        <th class="exa">Type</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
      </tr>
      <!-- now display information per config -->
      <xsl:apply-templates select="//configs[@type='dd_griddisk']/config"/>
    </table>
  </xsl:template>

  <xsl:template match="//configs[@type='dd_griddisk']/config">
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <td align="right">
        <xsl:apply-templates select="./@num_disks" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./@size" mode="number"/>
      </td>
      <td class="exabr"><xsl:value-of select="./@type"/></td>
      <xsl:if test="not(./cells[@id='1'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='1']" mode="list"/>
      <xsl:if test="not(./cells[@id='2'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='2']" mode="list"/>
    </tr>

  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for Celldisks                                       -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_celldisk']">
    <a name="CELL_CELLDISK"/>
    <h3 class="exa">Exadata Celldisks</h3>
    <table class="exa" border="0" width="600" summary="This table displays Exadata Celldisk Information">
      <tr class="exa">
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <td bgColor="White"></td>
        <th class="exa" colspan="2">1st</th>
        <th class="exa" colspan="2">2nd</th>
      </tr>
      <tr class="exa">
        <th class="exa">Disk Type</th>
        <th class="exa">CellDisk Size (GB)</th>
        <th class="exa"># Disks</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
      </tr>
      <!-- now display information per config -->
      <xsl:apply-templates select="//configs[@type='dd_celldisk']/config"/>
    </table>
  </xsl:template>

  <xsl:template match="//configs[@type='dd_celldisk']/config">
    <tr class="exa">
      <td><xsl:value-of select="./@disk_type"/></td>
      <td align="right">
        <xsl:apply-templates select="./@disk_size" mode="number"/>
      </td>
      <td class="exabr" align="right">
        <xsl:apply-templates select="./@num_disks" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <xsl:if test="not(./cells[@id='1'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='1']" mode="list"/>
      <xsl:if test="not(./cells[@id='2'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='2']" mode="list"/>
    </tr>

  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for ASM Diskgroups                                  -->
  <!-- ============================================================ -->
  <xsl:template match="//configs[@type='dd_asm_diskgroup']">
    <a name="ASM_DISKGROUP"/>
    <h3 class="exa">ASM Diskgroups</h3>
    <table class="exa" border="0" width="600" summary="This table displays Exadata ASM Diskgroups Information">
      <tr class="exa">
        <td bgColor="White"></td>
        <th class="exa">
          <xsl:attribute name="colspan">
            <xsl:choose>
              <xsl:when test="$hasMissingDisk='Y'">
                <xsl:value-of select="'6'"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="'5'"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>1st</th>
        <th class="exa">
          <xsl:attribute name="colspan">
            <xsl:choose>
              <xsl:when test="$hasMissingDisk='Y'">
                <xsl:value-of select="'6'"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="'5'"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:attribute>2nd</th>
      </tr>
      <tr class="exa">
        <th class="exa">Diskgroup</th>
        <th class="exa">Size (GB)</th>
        <th class="exa">Used (GB)</th>
        <th class="exa"># Disks</th>
        <th class="exa">Redundancy</th>
        <th class="exa">State</th>
        <xsl:if test="$hasMissingDisk = 'Y'">
          <th class="exa">Warning</th>
        </xsl:if>
        <th class="exa">Size (GB)</th>
        <th class="exa">Used (GB)</th>
        <th class="exa"># Disks</th>
        <th class="exa">Redundancy</th>
        <th class="exa">State</th>
        <xsl:if test="$hasMissingDisk = 'Y'">
          <th class="exa">Warning</th>
        </xsl:if>
      </tr>

      <!-- now display information per config -->
      <xsl:apply-templates select="//configs[@type='dd_asm_diskgroup']/config"/>
    </table>
  </xsl:template>

  <xsl:template match="//configs[@type='dd_asm_diskgroup']/config">
    <tr class="exa">
      <td class="exabr"><xsl:value-of select="./@name"/></td>
      <td align="right">
        <xsl:apply-templates select="./period[@id=1]/@total" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./period[@id=1]/@used" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./period[@id=1]/@disks" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td><xsl:value-of select="./period[@id=1]/@type"/></td>
      <td>
        <xsl:if test="$hasMissingDisk != 'Y'">
          <xsl:attribute name="class">
            <xsl:value-of select="'exabr'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="./period[@id=1]/@state"/>
      </td>
      <xsl:if test="$hasMissingDisk = 'Y'">
        <td class="exabr" nowrap="true">
          <xsl:if test="./period[@id=1 and @missing_disk='Y']">
            <xsl:attribute name="class">
              <xsl:value-of select="'exawarn'"/>
            </xsl:attribute>
            Missing Griddisks
          </xsl:if>
        </td>
      </xsl:if>
      <td align="right">
        <xsl:apply-templates select="./period[@id=2]/@total" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./period[@id=2]/@used" mode="number"/>
      </td>
      <td align="right">
        <xsl:apply-templates select="./period[@id=2]/@disks" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td><xsl:value-of select="./period[@id=2]/@type"/></td>
      <td><xsl:value-of select="./period[@id=2]/@state"/></td>
      <xsl:if test="$hasMissingDisk = 'Y'">
        <td nowrap="true">
          <xsl:if test="./period[@id=2 and @missing_disk='Y']">
            <xsl:attribute name="class">
              <xsl:value-of select="'exawarn'"/>
            </xsl:attribute>
            Missing Griddisks
          </xsl:if>
        </td>
      </xsl:if>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE for alerts summary                                  -->
  <!-- ============================================================ -->

  <xsl:template match="//cellstats[@type='dd_alerts']">
    <a name="CELL_ALERTS_SUMMARY"/>
    <h3 class="exa">Exadata Alerts Summary</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_alerts']/summs">
        <ul>
          <li class="exa">Number of open alerts at the end snapshot of both periods</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Exadata Alerts Summary">
          <tr>
            <td></td>
            <th class="exa" colspan="4">1st</th>
            <th class="exa" colspan="4">2nd</th>
          </tr>
          <tr class="exa">
            <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>
            <th class="exa">Total</th>
            <th class="exa">Critical</th>
            <th class="exa">Warning</th>
            <th class="exa">Info</th>
          </tr>
          <!-- display total -->
          <xsl:apply-templates select="./summs">
            <xsl:with-param name="name" select="'Total'"/>
          </xsl:apply-templates>
          <!-- display per cell totals -->
          <xsl:apply-templates select="./cells[@type='alerts']/cell/summs"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- display totals -->
  <xsl:template match="summs">
    <xsl:param name="name" select="''"/>
    <tr class="exa">
      <td class="exabr">
        <xsl:choose>
          <xsl:when test="$name = ''">
            <!-- create a link -->
            <a>
              <xsl:attribute name="href">
                <xsl:value-of select="concat('#CELL_ALERTS_DETAIL_',../@name)"/>
              </xsl:attribute>
              <xsl:value-of select="../@name"/>
            </a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$name"/>
          </xsl:otherwise>
        </xsl:choose>
      </td>
      <td align="right">
        <xsl:apply-templates select="./summ[@id='1']/@tot" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./summ[@id='1']/@crit" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./summ[@id='1']/@warn" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./summ[@id='1']/@info" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./summ[@id='2']/@tot" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./summ[@id='2']/@crit" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right">
        <xsl:apply-templates select="./summ[@id='2']/@warn" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
      <td align="right" class="exabr">
        <xsl:apply-templates select="./summ[@id='2']/@info" mode="number">
          <xsl:with-param name="decimalPoints" select="'N'"/>
        </xsl:apply-templates>
      </td>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for alerts details                                  -->
  <!-- ============================================================ -->

  <xsl:template match="//cellstats[@type='dd_alerts']/cells[@type='alerts']">
    <a name="CELL_ALERTS_DETAIL"/>
    <h3 class="exa">Exadata Alerts Details</h3>
    <ul>
      <li class="exa">Number of open alerts at the end snapshot of both periods</li>
      <li class="exa">Only the 10 most recent alerts per cell are available</li>
    </ul>
    <table class="exa" border="0" width="100%" summary="This table displays Exadata Alert Details">
      <tr>
        <th class="exa">1st</th>
        <th class="exa">2nd</th>
        <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>
      <!-- display alerts -->
      <xsl:apply-templates select="cell/alerts"/>
    </table>
  </xsl:template>

  <!-- intermediary step is needed for position() check to display name -->
  <xsl:template match="alerts">
    <xsl:apply-templates select="./alert"/>
  </xsl:template>

  <!-- individual alerts -->
  <xsl:template match="alert">
    <!-- retrieve cell name -->
    <xsl:variable name="cellName">
      <xsl:value-of select="../../@name"/>
    </xsl:variable>
    <tr class="exa">
      <td align="right"><xsl:value-of select="translate(./@id1,'1','Y')"/></td>
      <td align="right" class="exabr"><xsl:value-of select="translate(./@id2,'1','Y')"/></td>
      <td>
        <!-- only display name for first alert for that cell -->
        <xsl:if test="position() = 1">
          <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>
      <td><xsl:value-of select="./@begin_time"/></td>
      <td><xsl:value-of select="./@severity"/></td>
      <td><xsl:value-of select="./@state"/></td>
      <td style="width:auto"><xsl:value-of select="."/></td>
    </tr>
  </xsl:template>

  <xsl:template name="noAlertDetails">
    <a name="CELL_ALERTS_DETAIL"/>
    <h3 class="exa">Exadata Alerts Details</h3>
    <p><xsl:value-of select="$noDataMsg"/></p>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE for offline disks                                   -->
  <xsl:template match="//cellstats[@type='dd_offline_disks']">
    <a name="CELL_OFFLINE_DISKS"/>
    <h3 class="exa">Exadata Non-Online Disks</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_offline_disks']/disk">
        <ul>
          <li class="exa">Offline disks at the end snapshot of both periods</li>
        </ul>
        <table class="exa" border="0" width="600" summary="This table displays Exadata Offline disks">
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <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><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="offline_disks">
    <tr class="exa">
      <td align="right">
        <xsl:if test="./@id1">
          <xsl:attribute name="class">
            <xsl:value-of select="'exawarn'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="translate(./@id1,'1','Y')"/>
      </td>
      <td align="right" class="exabr">
        <xsl:if test="./@id2">
          <xsl:attribute name="class">
            <xsl:value-of select="'exawarn'"/>
          </xsl:attribute>
        </xsl:if>
        <xsl:value-of select="translate(./@id2,'1','Y')"/>
      </td>
      <td><xsl:value-of select="./@name"/></td>
      <td><xsl:value-of select="./@status"/></td>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- generic templates for stats                                  -->
  <!-- ============================================================ -->

  <!-- TEMPLATE:                                                    -->
  <!-- determine unit                                               -->
  <xsl:template match="cells" mode="getUnit">
    <xsl:param name="period"/>
    <xsl:param name="attrName"/>
    <!-- get unit based on cell rank = 0 -->
    <xsl:choose>
      <xsl:when test="./cell[@rank=0]/stat[@name=$attrName]/period[@id=$period]/@value">
        <xsl:apply-templates select="./cell[@rank=0]/stat[@name=$attrName]/period[@id=$period]/@value" mode="getMsUnit"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$UNIT_MS"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE: cells                                              -->
  <!-- match list of cells and determine unit then go through       -->
  <!-- individual cells                                             -->
  <xsl:template match="cells" mode="top">
    <xsl:variable name="diskType">
      <xsl:value-of select="./@disk_type"/>
    </xsl:variable>

    <xsl:variable name="toUnit1">
      <xsl:choose>
        <xsl:when test="../@type='dd_cell_latency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'1'"/>
            <xsl:with-param name="attrName" select="'st'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:when test="../@type='dd_cell_srvlatency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'1'"/>
            <xsl:with-param name="attrName" select="'ap'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$UNIT_NONE"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <xsl:variable name="toUnit2">
      <xsl:choose>
        <xsl:when test="../@type='dd_cell_latency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'2'"/>
            <xsl:with-param name="attrName" select="'st'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:when test="../@type='dd_cell_srvlatency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'2'"/>
            <xsl:with-param name="attrName" select="'ap'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$UNIT_NONE"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <!-- now go through individual cells -->
    <xsl:apply-templates select="./cell" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE: cell                                               -->
  <!-- go through cell and display metadata information for name    -->
  <!-- and call appropriate template for processing actual stats    -->
  <!-- for the various sections                                     -->
  <xsl:template match="cell" mode="top">
    <xsl:param name="toUnit1" select="$UNIT_NONE"/>
    <xsl:param name="toUnit2" select="$UNIT_NONE"/>
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="diskTypePosition" select="count(../preceding-sibling::cells) + 1"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
         <xsl:if test="./@rank = '0' and $diskTypePosition != 1">
           <xsl:value-of select="' exat'"/>
         </xsl:if>
      </xsl:attribute>
      <xsl:choose>
        <xsl:when test="./@rank='0'">
          <td class="exabr"><xsl:value-of select="$diskType"/></td>
          <xsl:if test="not(./stat[@name='meta'])">
            <td></td><td class="exabr"></td>
            <td></td><td class="exabr"></td>
          </xsl:if>
            <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta"/>       </xsl:when>
        <xsl:otherwise>
          <!-- put empty columns -->
          <td class="exabr"></td>
          <td></td><td class="exabr"></td>
          <td></td><td class="exabr"></td>
        </xsl:otherwise>
      </xsl:choose>
      <!-- get cell name -->
      <xsl:if test="../../@type = 'dd_cell_osstat'">
        <xsl:apply-templates select="." mode="top_cell_osstat"/>
      </xsl:if>
      <xsl:if test="../../@type = 'dd_cell_latency'">
        <xsl:apply-templates select="." mode="top_cell_latency">
          <xsl:with-param name="toUnit1" select="$toUnit1"/>
          <xsl:with-param name="toUnit2" select="$toUnit2"/>
        </xsl:apply-templates>
      </xsl:if>
      <xsl:if test="../../@type = 'dd_cell_srviorq'">
        <xsl:apply-templates select="." mode="top_cell_srviorq"/>
      </xsl:if>
      <xsl:if test="../../@type = 'dd_cell_srviomb'">
        <xsl:apply-templates select="." mode="top_cell_srviomb"/>
      </xsl:if>
      <xsl:if test="../../@type = 'dd_cell_srvlatency'">
        <xsl:apply-templates select="." mode="top_cell_srvlatency">
          <xsl:with-param name="toUnit1" select="$toUnit1"/>
          <xsl:with-param name="toUnit2" select="$toUnit2"/>
        </xsl:apply-templates>
      </xsl:if>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE: stat                                               -->
  <!-- displays metadata - # of cells and cell names                -->
  <xsl:template match="stat" mode="top_meta">
    <!-- get number of cells -->
    <xsl:if test="not(./period[@id='1']/@num_cells)">
      <td></td>
    </xsl:if>
    <xsl:apply-templates select="./period[@id='1']/@num_cells" mode="top_meta_info">
      <xsl:with-param name="alignment" select="'right'"/>
    </xsl:apply-templates>
    <xsl:if test="not(./period[@id='2']/@num_cells)">
      <td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./period[@id='2']/@num_cells" mode="top_meta_info">
      <xsl:with-param name="alignment" select="'right'"/>
      <xsl:with-param name="class" select="'exabr'"/>
    </xsl:apply-templates>
    <!-- get number of disks -->
    <xsl:if test="not(./period[@id='1']/@num_disks)">
      <td></td>
    </xsl:if>
    <xsl:apply-templates select="./period[@id='1']/@num_disks" mode="top_meta_info">
      <xsl:with-param name="alignment" select="'right'"/>
    </xsl:apply-templates>
    <xsl:if test="not(./period[@id='2']/@num_disks)">
      <td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./period[@id='2']/@num_disks" mode="top_meta_info">
      <xsl:with-param name="class" select="'exabr'"/>
      <xsl:with-param name="alignment" select="'right'"/>
    </xsl:apply-templates>
 </xsl:template>

 <!-- ============================================================ -->
 <!-- TEMPLATE: stat                                               -->
 <!-- name for both periods                                        --> 
 <xsl:template match="stat" mode="top_meta_info">
  <xsl:if test="not(./period[@id='1']/@name)">
    <td></td>
  </xsl:if>
  <xsl:apply-templates select="./period[@id='1']/@name" mode="top_meta_info"/>
  <xsl:if test="not(./period[@id='2']/@name)">
    <td class="exabr"></td>
  </xsl:if>
  <xsl:apply-templates select="./period[@id='2']/@name" mode="top_meta_info">
    <xsl:with-param name="class" select="'exabr'"/>
  </xsl:apply-templates>
 </xsl:template>

 <!-- ============================================================ -->
 <!-- TEMPLATE: stat                                               -->
 <!-- disk name and cell name for both periods                     -->
 <xsl:template match="stat" mode="top_meta_info_disk">
   <xsl:if test="not(./period[@id='1']/@cell)">
     <td></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='1']/@cell" mode="top_meta_info"/>
   <xsl:if test="not(./period[@id='1']/@name)">
     <td></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='1']/@name" mode="top_meta_info"/>
   <xsl:if test="not(./period[@id='2']/@cell)">
     <td></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='2']/@cell" mode="top_meta_info"/>
   <xsl:if test="not(./period[@id='2']/@name)">
     <td class="exabr"></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='2']/@name" mode="top_meta_info">
     <xsl:with-param name="class" select="'exabr'"/>
   </xsl:apply-templates>
 </xsl:template>

 <!-- ============================================================ -->
 <!-- TEMPLATE: stat - format to display is 1st, 2nd, diff         -->
 <xsl:template match="stat" mode="top">
   <xsl:param name="withDiff" select="'Y'"/>
   <xsl:param name="class" select="$NONE"/>
   <xsl:param name="toUnit1" select="$UNIT_NONE"/>
   <xsl:param name="toUnit2" select="$UNIT_NONE"/>
   <xsl:if test="not(./period[@id='1']/@value)">
     <td></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='1']/@value" mode="top">
     <xsl:with-param name="toUnit" select="$toUnit1"/>
   </xsl:apply-templates>
   <xsl:if test="not(./period[@id='2']/@value)">
     <td>
       <xsl:if test="$class != $NONE">
         <xsl:attribute name="class">
           <xsl:value-of select="$class"/>
         </xsl:attribute>
       </xsl:if>
     </td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='2']/@value" mode="top">
     <xsl:with-param name="toUnit" select="$toUnit2"/>
     <xsl:with-param name="class" select="$class"/>
   </xsl:apply-templates>
   <!-- only display diff column if requested -->
   <xsl:if test="$withDiff = 'Y'">
     <xsl:if test="not(./period[@id='diff']/@value)">
       <td class="exabr"></td>
     </xsl:if>
     <xsl:apply-templates select="./period[@id='diff']/@value" mode="top">
       <xsl:with-param name="class" select="'exabr'"/>
     </xsl:apply-templates>
   </xsl:if>
 </xsl:template>

 <!-- ============================================================ -->
 <!-- TEMPLATE: stat                                               -->
 <!-- . get specific attribute name from period                    -->
 <!--   with optionoal tooltips                                    -->
 <!--   no diff column                                             -->
 <xsl:template match="stat" mode="top_attr">
   <xsl:param name="attrName"/>
   <xsl:param name="class" select="'exabr'"/>
   <xsl:param name="tooltipLabel" select="$NONE"/>
   <xsl:param name="tooltipAttr" select="$NONE"/>
   <xsl:if test="not(./period[@id='1']/@*[local-name()=$attrName])">
     <td></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='1']/@*[local-name()=$attrName]" mode="top">
     <xsl:with-param name="tooltipLabel" select="$tooltipLabel"/>
     <xsl:with-param name="tooltipValue" select="./period[@id='1']/@*[local-name()=$tooltipAttr]"/>
   </xsl:apply-templates>
   <xsl:if test="not(./period[@id='2']/@*[local-name()=$attrName])">
     <td>
       <xsl:if test="$class != $NONE">
         <xsl:attribute name="class">
           <xsl:value-of select="$class"/>
         </xsl:attribute>
       </xsl:if>
    </td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='2']/@*[local-name()=$attrName]" mode="top">
     <xsl:with-param name="class" select="$class"/>
     <xsl:with-param name="tooltipLabel" select="$tooltipLabel"/>
     <xsl:with-param name="tooltipValue" select="./period[@id='2']/@*[local-name()=$tooltipAttr]"/>
   </xsl:apply-templates>
 </xsl:template>

 <!-- ============================================================ -->
 <!-- TEMPLATE: stat                                               -->
 <!-- . get specific attribute from period                         -->
 <!--   with optional tooltip                                      -->
 <!--   specific attribute for the diff column                     -->
 <xsl:template match="stat" mode="top_attr_diff">
   <xsl:param name="attrName"/>
   <xsl:param name="tooltipLabel" select="$NONE"/>
   <xsl:param name="tooltipAttr" select="$NONE"/>
   <xsl:param name="diffAttrName" select="'value'"/>
   <!-- display first two periods -->
   <xsl:apply-templates select="." mode="top_attr">
     <xsl:with-param name="attrName" select="$attrName"/>
     <xsl:with-param name="class" select="$NONE"/>
     <xsl:with-param name="tooltipLabel" select="$tooltipLabel"/>
     <xsl:with-param name="tooltipAttr" select="$tooltipAttr"/>
   </xsl:apply-templates>
   <!-- display diff -->
   <xsl:if test="not(./period[@id='diff']/@*[local-name()=$diffAttrName])">
     <td class="exabr"></td>
   </xsl:if>
   <xsl:apply-templates select="./period[@id='diff']/@*[local-name()=$diffAttrName]" mode="top">
     <xsl:with-param name="class" select="'exabr'"/>
   </xsl:apply-templates>
 </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE: period                                             -->
  <!-- . display value for the period                               -->
  <!--   with optional tooltip                                      -->
  <xsl:template match="period/@*" mode="top">
    <xsl:param name="class" select="$NONE"/>
    <xsl:param name="tooltipLabel" select="$NONE"/>
    <xsl:param name="tooltipValue" select="$NONE"/>
    <xsl:param name="toUnit" select="$UNIT_NONE"/>
    <xsl:variable name="statName">
      <xsl:value-of select="../../@name"/>
    </xsl:variable>
    <xsl:variable name="attrName">
      <xsl:value-of select="name(.)"/>
    </xsl:variable>
    <!-- determine if we need decimal points based on the statName -->
    <xsl:variable name="decimalPoints">
      <xsl:choose>
        <xsl:when test="$statName = 'fldwsout' or $statName = 'flrwout' or
                        $statName = 'fldwerr'  or $statName = 'flwerr'  or
                        $statName = 'flrwskp'">
          <xsl:value-of select="'N'"/>
        </xsl:when>
        <xsl:when test="$attrName = 'rank' or $attrName = 'rn_rq' or 
                       $attrName = 'rn_mb' or $attrName = 'rn_by'">
          <xsl:value-of select="'N'"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="'Y'"/>
        </xsl:otherwise>
    </xsl:choose>
    </xsl:variable>
    <!-- display column -->
    <td align="right">
      <!-- add class if required -->
      <xsl:if test="$class != $NONE">
        <xsl:attribute name="class">
          <xsl:value-of select="$class"/>
        </xsl:attribute>
      </xsl:if>
      <!-- add tooltip if required -->
      <xsl:if test="$tooltipValue != $NONE">
        <xsl:variable name="value">
          <xsl:apply-templates select="$tooltipValue" mode="number"/>
        </xsl:variable>
        <xsl:attribute name="title">
          <xsl:value-of select="concat($tooltipLabel,': ', $value)"/>
        </xsl:attribute>
      </xsl:if>
      <!-- format and display the number -->
      <xsl:choose>
        <xsl:when test="$toUnit = $UNIT_NONE">
          <xsl:apply-templates select="." mode="number">
            <xsl:with-param name="decimalPoints" select="$decimalPoints"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:apply-templates select="." mode="ms">
            <xsl:with-param name="toUnit" select="$toUnit"/>
          </xsl:apply-templates>
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- TEMPLATE: period                                             -->
  <!-- . display metadata, i.e. name                                -->
  <xsl:template match="period/@*" mode="top_meta_info">
    <xsl:param name="class" select="$NONE"/>
    <xsl:param name="alignment" select="$NONE"/>
    <xsl:variable name="cellstatsType" select="../../../../../@type"/>
    <td>
      <xsl:if test="$alignment != $NONE">
        <xsl:attribute name="align">
          <xsl:value-of select="$alignment"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:if test="$class != $NONE">
        <xsl:attribute name="class">
          <xsl:value-of select="$class"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:choose>
        <xsl:when test="name(.) = 'name' and . = 'All' and
                  ( $cellstatsType  = 'dd_smart_io' or
                    $cellstatsType = 'dd_flash_log' or
                    substring($cellstatsType,1,5) = 'dd_fc' or
                    substring($cellstatsType,1,5) = 'dd_rc')">
          <xsl:value-of select="concat('Total (', ../@num_cells,')')"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="."/>
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>

  <xsl:template match="disks" mode="getUnit">
    <xsl:param name="period"/>
    <xsl:param name="attrName"/>
    <!-- get unit based on disk rank = 0 -->
    <xsl:choose>
      <xsl:when test="./disk[@rank=0]/stat[@name=$attrName]/period[@id=$period]/@value">
        <xsl:apply-templates select="./disk[@rank=0]/stat[@name=$attrName]/period[@id=$period]/@value" mode="getMsUnit"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="$UNIT_MS"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>
  <!-- ============================================================ -->
  <!-- TEMPLATE: disks                                              -->
  <xsl:template match="disks" mode="top">
    <!-- TODO: add unit support here -->
    <xsl:variable name="toUnit1">
      <xsl:choose>
        <xsl:when test="../@type='dd_disk_latency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'1'"/>
            <xsl:with-param name="attrName" select="'st'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:when test="../@type='dd_disk_srvlatency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'1'"/>
            <xsl:with-param name="attrName" select="'ap'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$UNIT_NONE"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>
    <xsl:variable name="toUnit2">
      <xsl:choose>
        <xsl:when test="../@type='dd_disk_latency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'2'"/>
            <xsl:with-param name="attrName" select="'st'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:when test="../@type='dd_disk_srvlatency'">
          <xsl:apply-templates select="." mode="getUnit">
            <xsl:with-param name="period" select="'2'"/>
            <xsl:with-param name="attrName" select="'ap'"/>
          </xsl:apply-templates>
        </xsl:when>
        <xsl:otherwise>
          <xsl:value-of select="$UNIT_NONE"/>
        </xsl:otherwise>
      </xsl:choose>
    </xsl:variable>

    <!-- now go through each disk -->
    <xsl:apply-templates select="./disk" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TEMPLATE: disk                                               -->
  <!-- similar to cell, display disktype and then display actual    -->
  <!-- values for the rows                                          -->
  <xsl:template match="disk" mode="top">
    <xsl:param name="toUnit1" select="$UNIT_NONE"/>
    <xsl:param name="toUnit2" select="$UNIT_NONE"/>
    <xsl:variable name="diskType" select="../@disk_type"/>
    <xsl:variable name="diskTypePosition" select="count(../preceding-sibling::disks) + 1"/>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="./@rank = '0' and $diskTypePosition != 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <td class="exabr">
        <xsl:if test="./@rank = '0'">
          <xsl:value-of select="$diskType"/>
        </xsl:if>
      </td>
      <xsl:if test="../../@type='dd_disk_osstat'">
        <xsl:apply-templates select="." mode="top_disk_osstat"/>
      </xsl:if>
      <xsl:if test="../../@type='dd_disk_latency'">
        <xsl:apply-templates select="." mode="top_disk_latency">
          <xsl:with-param name="toUnit1" select="$toUnit1"/>
          <xsl:with-param name="toUnit2" select="$toUnit2"/>
        </xsl:apply-templates>
      </xsl:if>
      <xsl:if test="../../@type='dd_disk_srviorq'">
        <xsl:apply-templates select="." mode="top_disk_srviorq"/>
      </xsl:if>
      <xsl:if test="../../@type='dd_disk_srviomb'">
        <xsl:apply-templates select="." mode="top_disk_srviomb"/>
      </xsl:if>
      <xsl:if test="../../@type='dd_disk_srvlatency'">
        <xsl:apply-templates select="." mode="top_disk_srvlatency">
          <xsl:with-param name="toUnit1" select="$toUnit1"/>
          <xsl:with-param name="toUnit2" select="$toUnit2"/>
        </xsl:apply-templates>
      </xsl:if>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- individual sections                                          -->
  <!-- ============================================================ -->

  <!-- ============================================================ -->
  <!-- cell os statistics                                           -->
  <xsl:template match="//cellstats[@type='dd_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="./cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of IOPs</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top cells by IOPs">
          <tr>
            <td></td>
            <td></td><td></td>
            <td></td><td></td>
            <td></td><td></td>
            <th class="exa" colspan="5">IOPs</th>
            <th class="exa" colspan="5">IO MB/s</th>
            <td></td><td></td><td></td>
          </tr>
          <tr>
            <td></td>
            <th class="exa" colspan="2"># Cells</th>
            <th class="exa" colspan="2"># Disks</th>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="3">per Cell</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="3">per Cell</th>
            <th class="exa" colspan="3">%Utilization</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <!-- for OS IO Statistics - Top Cells Data columns -->
  <xsl:template match="cell" mode="top_cell_osstat">
    <!-- get cell name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
    <!-- get iops -->
    <xsl:if test="not(./stat[@name='iops'])">
      <td></td><td class="exabr"></td>
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <!-- display total and per cell -->
    <xsl:apply-templates select="./stat[@name='iops']" mode="top_attr">
      <xsl:with-param name="attrName" select="'tot'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='iops']" mode="top"/>
    <!-- get mbps -->
    <xsl:if test="not(./stat[@name='mbps'])">
      <td></td><td class="exabr"></td>
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='mbps']" mode="top_attr">
    <!-- display total and per cell -->
      <xsl:with-param name="attrName" select="'tot'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='mbps']" mode="top"/>
    <!-- get disk utilization -->
    <xsl:if test="not(./stat[@name='du'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='du']" mode="top"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- OS Latency statistics - Cells                                -->
  <xsl:template match="//cellstats[@type='dd_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="./cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Wait Time</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top cells by Wait Time">
          <tr>
            <td></td>
            <th class="exa" colspan="2"># Cells</th>
            <th class="exa" colspan="2"># Disks</th>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Service Time</th>
            <th class="exa" colspan="3">Wait Time</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="top_cell_latency">
    <xsl:param name="toUnit1" select="$UNIT_MS"/>
    <xsl:param name="toUnit2" select="$UNIT_MS"/>

    <!-- get cell name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
    <!-- get service time, if it doesn't exist display empty columns -->
    <xsl:if test="not(./stat[@name='st'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='st']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- get wait time, if it doesn't exist display empty columns -->
    <xsl:if test="not(./stat[@name='wt'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='wt']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- OS statistics - Disks                                        -->
  <xsl:template match="//cellstats[@type='dd_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="./disks">
        <ul>
          <li class="exa">Comparison Pairs: Disks are compared in descending order of IOPs</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top disks by IOPs">
          <tr>
            <td></td>
            <th class="exa" colspan="2">1st</th>
            <th class="exa" colspan="2">2nd</th>
            <th class="exa" colspan="3">IOPs</th>
            <th class="exa" colspan="3">IO MB/s</th>
            <th class="exa" colspan="3">%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">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="top"/>
        </table>        
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="top_disk_osstat">
    <!-- get cell name and disk name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info_disk"/>
    <!-- iops -->
    <xsl:if test="not(./stat[@name='iops'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='iops']" mode="top"/>
    <!-- mbps -->
    <xsl:if test="not(./stat[@name='mbps'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='mbps']" mode="top"/>
    <!-- utilization -->
    <xsl:if test="not(./stat[@name='du'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='du']" mode="top"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- OS Latency statistics - Disks                                -->
  <xsl:template match="//cellstats[@type='dd_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="./disks">
        <ul>
          <li class="exa">Comparison Pairs: Disks are compared in descending order of Wait Time</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top disks by Wait Time">
          <tr>
            <td></td>
            <th class="exa" colspan="2">1st</th>
            <th class="exa" colspan="2">2nd</th>
            <th class="exa" colspan="3">Service Time</th>
            <th class="exa" colspan="3">Wait Time</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="top_disk_latency">
    <xsl:param name="toUnit1" select="$UNIT_MS"/>
    <xsl:param name="toUnit2" select="$UNIT_MS"/>
    <!-- get cell name and disk name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info_disk"/>
    <!-- service time -->
    <xsl:if test="not(./stat[@name='st'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='st']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- wait time -->
    <xsl:if test="not(./stat[@name='wt'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='wt']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- OS CPU statistics                                            -->
  <xsl:template match="//cellstats[@type='dd_cpustat']" mode="top">
    <a name="OS_CPU_CELL_TOP"/>
    <h4 class="exa">Exadata OS CPU Statistics - Top Cells</h4>
    <xsl:choose>
      <xsl:when test="./cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of %CPU</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top cells by CPU Time">
          <tr>
            <th class="exa" colspan="2"># Cells</th>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">%CPU</th>
            <th class="exa" colspan="3">%User</th>
            <th class="exa" colspan="3">%Sys</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="top_cpustat"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="top_cpustat">
    <xsl:apply-templates select="./cell" mode="top_cpustat"/>
  </xsl:template>

  <xsl:template match="cell" mode="top_cpustat">
    <tr class="exa">
      <xsl:choose>
        <!-- first row for 'All' display # of cells -->
        <xsl:when test="./@rank = '0'">
          <td align="right"><xsl:value-of select="./stat[@name='meta']/period[@id='1']/@num_cells"/></td>
          <td align="right"><xsl:value-of select="./stat[@name='meta']/period[@id='2']/@num_cells"/></td>
        </xsl:when>
        <xsl:otherwise>
          <td></td><td></td>
        </xsl:otherwise>
      </xsl:choose>
      <!-- display cell name -->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <td><xsl:value-of select="./stat[@name='meta']/period[@id='1']/@name"/></td>
      <td class="exabr"><xsl:value-of select="./stat[@name='meta']/period[@id='2']/@name"/></td>
      <!-- % cpu -->
      <xsl:if test="not(./stat[@name='cpu'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='cpu']" mode="top"/>
      <!-- % usr -->
      <xsl:if test="not(./stat[@name='usr'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='usr']" mode="top"/>
      <!-- % sys -->
      <xsl:if test="not(./stat[@name='sys'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='sys']" mode="top"/>
    </tr>
  </xsl:template>


  <!-- ============================================================ -->
  <!-- Cell Server IOPS statistics - Cells                          -->
  <xsl:template match="//cellstats[@type='dd_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="./cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of total IOPs</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top cells by IOPs">
          <tr>
            <td></td>
            <th class="exa" colspan="2"># Cells</th>
            <th class="exa" colspan="2"># Disks</th>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="2">IOPs Total</th>
            <th class="exa" colspan="3">IOPs per Cell</th>
            <th class="exa" colspan="3">Small Reads</th>
            <th class="exa" colspan="3">Small Writes</th>
            <th class="exa" colspan="3">Large Reads</th>
            <th class="exa" colspan="3">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="top_cell_srviorq">
    <!-- get cell name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
    <!-- iorq -->
    <xsl:if test="not(./stat[@name='iorq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='iorq']" mode="top_attr">
      <xsl:with-param name="attrName" select="'tot'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='iorq']" mode="top"/>
    <!-- srrq -->
    <xsl:if test="not(./stat[@name='srrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='srrq']" mode="top"/>
    <!-- swrq -->
    <xsl:if test="not(./stat[@name='swrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='swrq']" mode="top"/>
    <!-- lrrq -->
    <xsl:if test="not(./stat[@name='lrrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lrrq']" mode="top"/>
    <!-- lwrq -->
    <xsl:if test="not(./stat[@name='lwrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lwrq']" mode="top"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Cell Server IO MB/s statistics - Cells                       -->
  <xsl:template match="//cellstats[@type='dd_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="./cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of total IO MB/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top cells by IO MB/s">
          <tr>
            <td></td>
            <th class="exa" colspan="2"># Cells</th>
            <th class="exa" colspan="2"># Disks</th>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="2">IO MB/s Total</th>
            <th class="exa" colspan="3">IO MB/s per Cell</th>
            <th class="exa" colspan="3">Small Reads</th>
            <th class="exa" colspan="3">Small Writes</th>
            <th class="exa" colspan="3">Large Reads</th>
            <th class="exa" colspan="3">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="top_cell_srviomb">
    <!-- get cell name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
    <!-- iomb -->
    <xsl:if test="not(./stat[@name='iomb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='iomb']" mode="top_attr">
      <xsl:with-param name="attrName" select="'tot'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='iomb']" mode="top"/>
    <!-- srmb -->
    <xsl:if test="not(./stat[@name='srmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='srmb']" mode="top"/>
    <!-- swmb -->
    <xsl:if test="not(./stat[@name='swmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='swmb']" mode="top"/>
    <!-- lrmb -->
    <xsl:if test="not(./stat[@name='lrmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lrmb']" mode="top"/>
    <!-- lwmb -->
    <xsl:if test="not(./stat[@name='lwmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lwmb']" mode="top"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Cell Server Latency statistics - Cells                       -->
  <xsl:template match="//cellstats[@type='dd_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="./cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of IO Latency</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top cells by cell server latency">
          <tr>
            <td></td>
            <th class="exa" colspan="2"># Cells</th>
            <th class="exa" colspan="2"># Disks</th>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Cell Latency</th>
            <th class="exa" colspan="3">Small Reads</th>
            <th class="exa" colspan="3">Small Writes</th>
            <th class="exa" colspan="3">Large Reads</th>
            <th class="exa" colspan="3">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="top_cell_srvlatency">
    <xsl:param name="toUnit1" select="$UNIT_MS"/>
    <xsl:param name="toUnit2" select="$UNIT_MS"/>
    <!-- get cell name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
    <!-- cell latency -->
    <xsl:if test="not(./stat[@name='ap'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='ap']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- sr -->
    <xsl:if test="not(./stat[@name='sr'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='sr']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- sw -->
    <xsl:if test="not(./stat[@name='sw'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='sw']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- lr -->
    <xsl:if test="not(./stat[@name='lr'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lr']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- lw -->
    <xsl:if test="not(./stat[@name='lw'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lw']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>

  </xsl:template>

  <!-- ============================================================ -->
  <!-- Cell Server IOPs statistics - Disks                          -->
  <xsl:template match="//cellstats[@type='dd_disk_srviorq']" mode="top">
    <a name="CELLSRV_IOPS_DISK_TOP"/>
    <h4 class="exa">Exadata Cell Server IOPS Statistics - Top Disks</h4>
    <xsl:choose>
      <xsl:when test="./disks">
        <ul><li class="exa">Comparison Pairs: Disks are compared in descending order of total IOPs</li></ul>
        <table  class="exa" border="0" summary="This table displays the comparison of top disks by cell server IOPs">
          <tr>
            <td></td>
            <th class="exa" colspan="2">1st</th>
            <th class="exa" colspan="2">2nd</th>
            <th class="exa" colspan="3">IOPs</th>
            <th class="exa" colspan="3">Small Reads</th>
            <th class="exa" colspan="3">Small Writes</th>
            <th class="exa" colspan="3">Large Reads</th>
            <th class="exa" colspan="3">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="top_disk_srviorq">
    <!-- get cell name and disk name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info_disk"/>
    <!-- iorq -->
    <xsl:if test="not(./stat[@name='iorq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='iorq']" mode="top"/>
    <!-- srrq -->
    <xsl:if test="not(./stat[@name='srrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='srrq']" mode="top"/>
    <!-- swrq -->
    <xsl:if test="not(./stat[@name='swrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='swrq']" mode="top"/>
    <!-- lrrq -->
    <xsl:if test="not(./stat[@name='lrrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lrrq']" mode="top"/>
    <!-- lwrq -->
    <xsl:if test="not(./stat[@name='lwrq'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lwrq']" mode="top"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Cell Server IO MB/s statistics - Disks                       -->
  <xsl:template match="//cellstats[@type='dd_disk_srviomb']" mode="top">
    <a name="CELLSRV_MBPS_DISK_TOP"/>
    <h4 class="exa">Exadata Cell Server IO MB/s Statistics - Top Disks</h4>
    <xsl:choose>
      <xsl:when test="./disks">
        <ul><li class="exa">Comparison Pairs: Disks are compared in descending order of total IO MB/s</li></ul>
        <table  class="exa" border="0" summary="This table displays the comparison of top disks by cell server IO MB/s">
          <tr>
            <td></td>
            <th class="exa" colspan="2">1st</th>
            <th class="exa" colspan="2">2nd</th>
            <th class="exa" colspan="3">IO MB/s</th>
            <th class="exa" colspan="3">Small Reads</th>
            <th class="exa" colspan="3">Small Writes</th>
            <th class="exa" colspan="3">Large Reads</th>
            <th class="exa" colspan="3">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="top_disk_srviomb">
    <!-- get cell name and disk name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info_disk"/>
    <!-- iomb -->
    <xsl:if test="not(./stat[@name='iomb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='iomb']" mode="top"/>
    <!-- srmb -->
    <xsl:if test="not(./stat[@name='srmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='srmb']" mode="top"/>
    <!-- swmb -->
    <xsl:if test="not(./stat[@name='swmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='swmb']" mode="top"/>
    <!-- lrmb -->
    <xsl:if test="not(./stat[@name='lrmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lrmb']" mode="top"/>
    <!-- lwmb -->
    <xsl:if test="not(./stat[@name='lwmb'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lwmb']" mode="top"/>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Cell Server Latency statistics - Disks                       -->
  <xsl:template match="//cellstats[@type='dd_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="./disks">
        <ul><li class="exa">Comparison Pairs: Disks are compared in descending order of cell latency</li></ul>
        <table  class="exa" border="0" summary="This table displays the comparison of top disks by cell server Latency">
          <tr>
            <td></td>
            <th class="exa" colspan="2">1st</th>
            <th class="exa" colspan="2">2nd</th>
            <th class="exa" colspan="3">Cell Latency</th>
            <th class="exa" colspan="3">Small Reads</th>
            <th class="exa" colspan="3">Small Writes</th>
            <th class="exa" colspan="3">Large Reads</th>
            <th class="exa" colspan="3">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">Disk Type</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">Cell Name</th>
            <th class="exa">Disk Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./disks" mode="top"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="disk" mode="top_disk_srvlatency">
    <xsl:param name="toUnit1" select="$UNIT_MS"/>
    <xsl:param name="toUnit2" select="$UNIT_MS"/>
    <!-- get cell name and disk name -->
    <xsl:if test="not(./stat[@name='meta'])">
      <td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info_disk"/>
    <!-- ap latency -->
    <xsl:if test="not(./stat[@name='ap'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='ap']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- sr -->
    <xsl:if test="not(./stat[@name='sr'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='sr']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- sw -->
    <xsl:if test="not(./stat[@name='sw'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='sw']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- lr -->
    <xsl:if test="not(./stat[@name='lr'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lr']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
    <!-- lw -->
    <xsl:if test="not(./stat[@name='lw'])">
      <td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='lw']" mode="top">
      <xsl:with-param name="toUnit1" select="$toUnit1"/>
      <xsl:with-param name="toUnit2" select="$toUnit2"/>
    </xsl:apply-templates>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Smart I/O                                                    -->
  <xsl:template match="//cellstats[@type='dd_smart_io']" mode="top">
    <a name="CELL_SMART_IO"/>
    <h4 class="exa">Smart IO</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_smart_io']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of MB/s Requested</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of smart IO">
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">MB/s Requested</th>
            <th class="exa" colspan="3">%Opt Storage Index</th>
            <th class="exa" colspan="3">%Opt Flash Cache</th>
            <th class="exa" colspan="3">%Offload Efficiency</th>
            <th class="exa" colspan="3">%Passthru</th>
            <th class="exa" colspan="3">%Reverse Offload</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="diff_generic">
    <xsl:choose>
      <xsl:when test="../@type = 'dd_smart_io'">
        <xsl:apply-templates select="./cell" mode="diff_smart_io"/>        
      </xsl:when>
      <xsl:when test="../@type = 'dd_flash_log'">
        <xsl:apply-templates select="./cell" mode="diff_flash_log"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_fc_ureads'">
        <xsl:apply-templates select="./cell" mode="diff_fc_ureads"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_fc_uwrites'">
        <xsl:apply-templates select="./cell" mode="diff_fc_uwrites"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_fc_ireads'">
        <xsl:apply-templates select="./cell" mode="diff_fc_ireads"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_fc_iwrites'">
        <xsl:apply-templates select="./cell" mode="diff_fc_iwrites"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_rc_ureads'">
        <xsl:apply-templates select="./cell" mode="diff_rc_ureads"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_rc_iwrites'">
        <xsl:apply-templates select="./cell" mode="diff_rc_iwrites"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_rc_spc'">
        <xsl:apply-templates select="./cell" mode="diff_rc_spc"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_ioreason_rq'">
        <xsl:apply-templates select="./cell" mode="diff_ioreason_rq"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_ioreason_mb'">
        <xsl:apply-templates select="./cell" mode="diff_ioreason_mb"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_dbpercell_rq'">
        <xsl:apply-templates select="./cell" mode="diff_dbpercell_rq"/>
      </xsl:when>
      <xsl:when test="../@type = 'dd_dbpercell_mb'">
        <xsl:apply-templates select="./cell" mode="diff_dbpercell_mb"/>
      </xsl:when>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_smart_io">
    <tr class="exa">
      <!-- get cell name -->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- get data for columns  -->
      <xsl:if test="not(./stat[@name='smiot'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='smiot']" mode="top"/>
      <!-- storage index -->
      <xsl:if test="not(./stat[@name='stind'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='stind']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct'"/>
        <xsl:with-param name="tooltipLabel" select="'Storage Index MB/s'"/>
        <xsl:with-param name="tooltipAttr" select="'value'"/>
      </xsl:apply-templates>
      <!-- flash cache -->
      <xsl:if test="not(./stat[@name='smiofc'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='smiofc']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct'"/>
        <xsl:with-param name="tooltipLabel" select="'Flash Cache MB/s'"/>
        <xsl:with-param name="tooltipAttr" select="'value'"/>
      </xsl:apply-templates>
      <!-- offload -->
      <xsl:if test="not(./stat[@name='smiofl'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='smiofl']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct'"/>
        <xsl:with-param name="tooltipLabel" select="'Offload MB/s'"/>
        <xsl:with-param name="tooltipAttr" select="'value'"/>
      </xsl:apply-templates>
      <!-- passthru -->
      <xsl:if test="not(./stat[@name='smiopt'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='smiopt']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct'"/>
        <xsl:with-param name="tooltipLabel" select="'Passthru MB/s'"/>
        <xsl:with-param name="tooltipAttr" select="'value'"/>
      </xsl:apply-templates>
      <!-- reverse offload -->
      <xsl:if test="not(./stat[@name='smiopdb'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='smiopdb']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct'"/>
        <xsl:with-param name="tooltipLabel" select="'Reverse Offload MB/s'"/>
        <xsl:with-param name="tooltipAttr" select="'value'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Flash log                                                    -->
  <xsl:template match="//cellstats[@type='dd_flash_log']" mode="top">
    <a name="CELL_FLASH_LOG_MAIN"/>
    <h4 class="exa">Flash Log</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_flash_log']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Write Requests/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash log statistics">
          <tr>
            <td></td><td></td>
            <td></td><td></td><td></td>
            <td></td><td></td><td></td>
            <th class="exa" colspan="7">First Writes/s</th>
            <th class="exa" colspan="7">Outliers</th>
            <th class="exa" colspan="4">Errors</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Write Requests/s</th>
            <th class="exa" colspan="3">Write MB/s</th>
            <th class="exa" colspan="3">%Flash Log</th>
            <th class="exa" colspan="2">Flash Log</th>
            <th class="exa" colspan="2">DB Log</th>
            <th class="exa" colspan="3">%Efficiency</th>
            <th class="exa" colspan="2">Prevented</th>
            <th class="exa" colspan="2">Actual</th>
            <th class="exa" colspan="2">Disk I/O</th>
            <th class="exa" colspan="2">Flash I/O</th>
            <th class="exa" colspan="2">Keep (MB)</th>
            <th class="exa" colspan="2">Skip Count</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_flash_log">
    <tr class="exa">
      <!-- get cell name -->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data for columns -->
      <!-- redo writes -->
      <xsl:if test="not(./stat[@name='flrwsvc'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flrwsvc']" mode="top"/>
      <!-- redo bytes -->
      <xsl:if test="not(./stat[@name='flrwbsvc'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flrwbsvc']" mode="top"/>
      <!-- %flash log first -->
      <xsl:if test="not(./stat[@name='flwffp'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flwffp']" mode="top"/>
      <!-- flash log first -->
      <xsl:if test="not(./stat[@name='flwff'])">
        <td></td><td></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flwff']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
      </xsl:apply-templates>
      <!-- db log first -->
      <xsl:if test="not(./stat[@name='flwfd'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flwfd']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <!-- efficiency -->
      <xsl:if test="not(./stat[@name='fleff'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fleff']" mode="top"/>
      <!-- saved outliers -->
      <xsl:if test="not(./stat[@name='fldwsout'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fldwsout']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
      </xsl:apply-templates>
      <!-- outliers -->
      <xsl:if test="not(./stat[@name='flrwout'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flrwout']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <!-- disk errors -->
      <xsl:if test="not(./stat[@name='fldwerr'])">
        <td></td><td></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fldwerr']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
      </xsl:apply-templates>
      <!-- flash errors -->
      <xsl:if test="not(./stat[@name='flwerr'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flwerr']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <!-- redo bytes saved -->
      <xsl:if test="not(./stat[@name='flrbsav'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flrbsav']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
      <!-- skipped -->
      <xsl:if test="not(./stat[@name='flrwskp'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='flrwskp']" mode="top">
        <xsl:with-param name="withDiff" select="'N'"/>
        <xsl:with-param name="class" select="'exabr'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Flash Cache Configuration                                    -->
  <xsl:template match="//config[@type='dd_fc']" mode="top">
    <a name="CELL_FLASH_CACHE_CONFIG"/>
    <h4 class="exa">Flash Cache Configuration</h4>
    <table class="exa" border="0" width="600" summary="This table displays Flash Cache Configuration">
      <tr>
        <td></td><td></td><td></td>
        <th class="exa" colspan="2">1st</th>
        <th class="exa" colspan="2">2nd</th>
      </tr>
      <tr>
        <th class="exa">Mode</th>
        <th class="exa">Compression</th>
        <th class="exa">Status</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
        <th class="exa"># Cells</th>
        <th class="exa">Cells</th>
      </tr>
      <xsl:apply-templates select="./fc" mode="top"/>
    </table>
  </xsl:template>

  <!-- flash cache configuration individual config rows -->
  <xsl:template match="fc" mode="top">
    <tr class="exa">
      <td><xsl:value-of select="./@mode"/></td>
      <td><xsl:value-of select="./@compress"/></td>
      <td><xsl:value-of select="./@status"/></td>
      <xsl:if test="not(./cells[@id='1'])">
        <td></td><td></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='1']" mode="fc_config"/>
      <xsl:if test="not(./cells[@id='2'])">
        <td></td><td></td>
      </xsl:if>
      <xsl:apply-templates select="./cells[@id='2']" mode="fc_config"/>
    </tr>
  </xsl:template>

  <!-- flash cache configuration - cell names -->
  <xsl:template match="cells" mode="fc_config">
    <td align="right"><xsl:value-of select="./@num_cells"/></td>
    <td>
      <xsl:choose>
        <xsl:when test="./@cellname">
          <xsl:value-of select="./@cellname"/>
        </xsl:when>
        <xsl:otherwise>
          <xsl:call-template name="join">
            <xsl:with-param name="list" select="./cell"/>
            <xsl:with-param name="separator" select="','"/>
          </xsl:call-template>
        </xsl:otherwise>
      </xsl:choose>
    </td>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- TODO: Flash Cache Space Usage                                -->
  

  <!-- ============================================================ -->
  <!-- Flash Cache User Reads                                       -->
  <xsl:template match="//cellstats[@type='dd_fc_ureads']" mode="top">
    <a name="CELL_FLASH_CACHE_UREADS"/>
    <h4 class="exa">Flash Cache User Reads</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_ureads']/cells/*">
        <ul>
          <li class="exa">OLTP/Scan/Columnar reads include reads on keep objects</li>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Read Requests/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash Cache User Reads statistics">
          <tr>
            <td></td><td></td>
            <th class="exa" colspan="11">Read Requests/s</th>
            <th class="exa" colspan="11">Read MB/s</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Total Hits</th>
            <th class="exa" colspan="2">OLTP</th>
            <th class="exa" colspan="2">Scan</th>
            <th class="exa" colspan="2">Columnar</th>
            <th class="exa" colspan="2">Keep</th>
            <th class="exa" colspan="3">Total Hits</th>
            <th class="exa" colspan="2">OLTP</th>
            <th class="exa" colspan="2">Scan</th>
            <th class="exa" colspan="2">Columnar</th>
            <th class="exa" colspan="2">Keep</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_fc_ureads">
    <tr class="exa">
      <!-- get cell name-->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data columns requests -->
      <xsl:if test="not(stat[@name='fcior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcior']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fcoior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcoior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fcsior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcsior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fccior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fccior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fckpior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fckpior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <!-- data columns mbps -->
      <xsl:if test="not(stat[@name='fcior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcior']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fcoior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcoior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fcsior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcsior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fccior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fccior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fckpior'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fckpior']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Flash Cache User Reads Efficiency                            -->
  <xsl:template match="//cellstats[@type='dd_fc_ureads']" mode="eff">
    <a name="CELL_FLASH_CACHE_UREADS_EFF"/>
    <h4 class="exa">Flash Cache Efficiency</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_ureads']/cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Read Requests/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash Cache User Reads Efficiency">
          <tr>
            <td></td><td></td>
            <th class="exa" colspan="7">OLTP</th>
            <th class="exa" colspan="7">Scan</th>
            <th class="exa" colspan="9">Columnar</th>
            <th class="exa" colspan="7">Keep</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="2">Read Hits/s</th>
            <th class="exa" colspan="2">Misses/s</th>
            <th class="exa" colspan="3">%Hit</th>
            <th class="exa" colspan="2">Read MB/s</th>
            <th class="exa" colspan="2">Attempted MB/s</th>
            <th class="exa" colspan="3">%Hit</th>
            <th class="exa" colspan="2">Read Hits/s</th>
            <th class="exa" colspan="2">Eligible MB/s</th>
            <th class="exa" colspan="2">Saved MB/s</th>
            <th class="exa" colspan="3">%Efficiency</th>
            <th class="exa" colspan="2">Read Req/s</th>
            <th class="exa" colspan="2">Misses/s</th>
            <th class="exa" colspan="3">%Hit</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="eff"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cells" mode="eff">
    <xsl:apply-templates select="./cell" mode="eff"/>
  </xsl:template>

  <xsl:template match="cell" mode="eff">
    <tr class="exa">
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
    <!-- OLTP data columns -->
    <xsl:if test="not(./stat[@name='fcoior'])">
      <td></td><td></td><td></td><td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='fcoior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'rqps'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fcoior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'miss'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fcoior']" mode="top_attr_diff">
      <xsl:with-param name="attrName" select="'eff'"/>
      <xsl:with-param name="diffAttrName" select="'eff'"/>
    </xsl:apply-templates>
    <!-- Scan data columns -->
    <xsl:if test="not(./stat[@name='fcsior'])">
      <td></td><td></td><td></td><td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='fcsior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'mbps'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fcsior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'att'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fcsior']" mode="top_attr_diff">
      <xsl:with-param name="attrName" select="'eff'"/>
      <xsl:with-param name="diffAttrName" select="'eff'"/>
    </xsl:apply-templates>
    <!-- columnar data columns -->
    <xsl:if test="not(./stat[@name='fccior'])">
      <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='fccior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'mbps'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fccior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'elig'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fccior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'save'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fccior']" mode="top_attr_diff">
      <xsl:with-param name="attrName" select="'eff'"/>
      <xsl:with-param name="diffAttrName" select="'eff'"/>
    </xsl:apply-templates>
    <!-- Keep data columns -->
    <xsl:if test="not(./stat[@name='fckpior'])">
      <td></td><td></td><td></td><td></td><td></td><td></td><td class="exabr"></td>
    </xsl:if>
    <xsl:apply-templates select="./stat[@name='fckpior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'rqps'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fckpior']" mode="top_attr">
      <xsl:with-param name="attrName" select="'miss'"/>
    </xsl:apply-templates>
    <xsl:apply-templates select="./stat[@name='fckpior']" mode="top_attr_diff">
      <xsl:with-param name="attrName" select="'eff'"/>
      <xsl:with-param name="diffAttrName" select="'eff'"/>
    </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Flash Cache User Writes                                      -->
  <xsl:template match="//cellstats[@type='dd_fc_uwrites']" mode="top">
    <a name="CELL_FLASH_CACHE_UWRITES"/>
    <h4 class="exa">Flash Cache User Writes</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_uwrites']/cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Write Requests/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash Cache User Writes statistics">
          <tr>
            <td></td><td></td>
            <xsl:choose>
              <xsl:when test="$showPartialWrites = 'Y'">
                <th class="exa" colspan="13">Write Requests/s</th>
                <th class="exa" colspan="13">Write MB/s</th>
              </xsl:when>
              <xsl:otherwise>
                <th class="exa" colspan="11">Write Requests/s</th>
                <th class="exa" colspan="11">Write MB/s</th>
              </xsl:otherwise>
            </xsl:choose>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">First Writes</th>
            <th class="exa" colspan="2">Overwrites</th>
            <xsl:if test="$showPartialWrites = 'Y'">
              <th class="exa" colspan="2">Partial Writes</th>              
            </xsl:if>
            <th class="exa" colspan="2">Keep</th>
            <th class="exa" colspan="2">Large Writes</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">First Writes</th>
            <th class="exa" colspan="2">Overwrites</th>
            <xsl:if test="$showPartialWrites = 'Y'">
              <th class="exa" colspan="2">Partial Writes</th>              
            </xsl:if>
            <th class="exa" colspan="2">Keep</th>
            <th class="exa" colspan="2">Large Writes</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <xsl:if test="$showPartialWrites = 'Y'">
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
            </xsl:if>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <xsl:if test="$showPartialWrites = 'Y'">
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
            </xsl:if>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_fc_uwrites">
    <tr class="exa">
      <!-- get cell name -->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data columns requests -->
      <xsl:if test="not(stat[@name='fciow'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciow']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fciowf'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciowf']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fciowow'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciowow']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="$showPartialWrites = 'Y'">
        <xsl:if test="not(stat[@name='fciowp'])">
          <td></td><td class="exabr"></td>
        </xsl:if>
        <xsl:apply-templates select="./stat[@name='fciowp']" mode="top_attr">
          <xsl:with-param name="attrName" select="'rqps'"/>
        </xsl:apply-templates>
      </xsl:if>
      <xsl:if test="not(stat[@name='fckpiow'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fckpiow']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <td align="right">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rqps'"/>
          <xsl:with-param name="periodId" select="'1'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rqps'"/>
          <xsl:with-param name="periodId" select="'2'"/>
        </xsl:call-template>
      </td>

      <!-- data columns mbps -->
      <xsl:if test="not(stat[@name='fciow'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciow']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fciowf'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciowf']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fciowow'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciowow']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="$showPartialWrites = 'Y'">
        <xsl:if test="not(stat[@name='fciowp'])">
          <td></td><td class="exabr"></td>
        </xsl:if>
        <xsl:apply-templates select="./stat[@name='fciowp']" mode="top_attr">
          <xsl:with-param name="attrName" select="'mbps'"/>
        </xsl:apply-templates>
      </xsl:if>
      <xsl:if test="not(stat[@name='fckpiow'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fckpiow']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <td align="right">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mbps'"/>
          <xsl:with-param name="periodId" select="'1'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mbps'"/>
          <xsl:with-param name="periodId" select="'2'"/>
        </xsl:call-template>
      </td>
    </tr>
  </xsl:template>

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

        <xsl:value-of select="./stat[@name=$statName]/period[@id=$periodId]/@*[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>

  <!-- large writes -->
  <xsl:template name="flashCacheComputeLWSum">
    <xsl:param name="attrName"/>
    <xsl:param name="periodId"/>
    <xsl:param name="decimalPoints" select="'Y'"/>

    <xsl:variable name="fcLWROW">
      <xsl:call-template name="getLWValue">
        <xsl:with-param name="statName" select="'fclwrow'"/>
        <xsl:with-param name="attrName" select="$attrName"/>
        <xsl:with-param name="periodId" select="$periodId"/>
      </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:with-param name="periodId" select="$periodId"/>
      </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:with-param name="periodId" select="$periodId"/>
      </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>

  <!-- ============================================================ -->
  <!-- Flash Cache User Writes - Large Writes                       -->
  <!-- ============================================================ -->
  <xsl:template match="//cellstats[@type='dd_fc_uwrites']" mode="top_lw">
    <a name="CELL_FLASH_CACHE_UWRITES_LW"/>
    <h4 class="exa">Flash Cache User Writes - Large Writes</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_uwrites']/cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Write Requests/s</li>
          <li class="exa">Large Writes consist of Temp Spills, Writes to Data and Temp Tables, and Write Only Operations</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash Cache User Writes - Large Write statistics">
          <tr>
            <td></td><td></td>
            <th class="exa" colspan="11">Write Requests/s</th>
            <th class="exa" colspan="11">Write MB/s</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Large Writes</th>
            <th class="exa" colspan="2">Temp Spill</th>
            <th class="exa" colspan="2">Data/Temp Tables</th>
            <th class="exa" colspan="2">Write Only</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Large Writes</th>
            <th class="exa" colspan="2">Temp Spill</th>
            <th class="exa" colspan="2">Data/Temp Tables</th>
            <th class="exa" colspan="2">Write Only</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells/cell" mode="diff_fc_uwrites_lw"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>


  <xsl:template match="cell" mode="diff_fc_uwrites_lw">
    <tr class="exa">
      <!-- get cell name -->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- get totals -->
      <!-- data columns requests -->
      <xsl:if test="not(stat[@name='fciow'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciow']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <td align="right">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rqps'"/>
          <xsl:with-param name="periodId" select="'1'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'rqps'"/>
          <xsl:with-param name="periodId" select="'2'"/>
        </xsl:call-template>
      </td>
      <xsl:if test="not(stat[@name='fclwrow'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fclwrow']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fclwmrw'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fclwmrw']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fclwnrw'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fclwnrw']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>

      <!-- get mbps -->
      <xsl:if test="not(stat[@name='fciow'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciow']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <td align="right">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mbps'"/>
          <xsl:with-param name="periodId" select="'1'"/>
        </xsl:call-template>
      </td>
      <td align="right" class="exabr">
        <xsl:call-template name="flashCacheComputeLWSum">
          <xsl:with-param name="attrName" select="'mbps'"/>
          <xsl:with-param name="periodId" select="'2'"/>
        </xsl:call-template>
      </td>
      <xsl:if test="not(stat[@name='fclwrow'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fclwrow']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fclwmrw'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fclwmrw']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fclwnrw'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fclwnrw']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>
  

  <!-- ============================================================ -->
  <!-- Flash Cache Internal Reads                                   -->
  <!-- TODO: add new disk writer stats                              -->
  <xsl:template match="//cellstats[@type='dd_fc_ireads']" mode="top">
    <a name="CELL_FLASH_CACHE_IREADS"/>
    <h4 class="exa">Flash Cache Internal Reads</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_ireads']/cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Read Requests/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash Cache Internal Reads statistics">
          <tr>
            <td></td><td></td>
            <td></td><td></td><td></td>
            <td></td><td></td><td></td>
            <xsl:if test="$showDiskWriter = 'Y'">
              <th class="exa" colspan="8">Disk Writer IO Detail</th>
            </xsl:if>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Read to Disk Write Requests/s</th>
            <th class="exa" colspan="3">Read to Disk Write MB/s</th>
            <xsl:if test="$showDiskWriter = 'Y'">
              <th class="exa" colspan="2">Read Reqs/s from Flash</th>
              <th class="exa" colspan="2">Read MB/s from Flash</th>
              <th class="exa" colspan="2">Write Reqs/ to Hard Disk</th>
              <th class="exa" colspan="2">Write MB/s to Hard Disk</th>
            </xsl:if>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <xsl:if test="$showDiskWriter = 'Y'">
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
            </xsl:if>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_fc_ireads">
    <tr class="exa">
      <!-- get cell name-->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data columns requests -->
      <xsl:if test="not(./stat[@name='fciordw'])">
        <td></td><td></td><td class="exabr"/>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciordw']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <!-- data columns mbps -->
      <xsl:if test="not(./stat[@name='fciordw'])">
        <td></td><td></td><td class="exabr"/>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciordw']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>

      <!-- disk writer detail -->
      <xsl:if test="$showDiskWriter = 'Y'">
        <xsl:if test="not(./stat[@name='fciordkwr'])">
          <td></td><td class="exabr"></td><td></td><td class="exabr"></td>
        </xsl:if>
        <xsl:apply-templates select="./stat[@name='fciordkwr']" mode="top_attr">
          <xsl:with-param name="attrName" select="'rqps'"/>        
        </xsl:apply-templates>
        <xsl:apply-templates select="./stat[@name='fciordkwr']" mode="top_attr">
          <xsl:with-param name="attrName" select="'mbps'"/>        
        </xsl:apply-templates>
        <xsl:if test="not(./stat[@name='fciowdkwr'])">
          <td></td><td class="exabr"></td><td></td><td class="exabr"></td>
        </xsl:if>
        <xsl:apply-templates select="./stat[@name='fciowdkwr']" mode="top_attr">
          <xsl:with-param name="attrName" select="'rqps'"/>        
        </xsl:apply-templates>
        <xsl:apply-templates select="./stat[@name='fciowdkwr']" mode="top_attr">
          <xsl:with-param name="attrName" select="'mbps'"/>        
        </xsl:apply-templates>
      </xsl:if>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Flash Cache Internal Writes                                  -->
  <xsl:template match="//cellstats[@type='dd_fc_iwrites']" mode="top">
    <a name="CELL_FLASH_CACHE_IWRITES"/>
    <h4 class="exa">Flash Cache Internal Writes</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_fc_iwrites']/cells">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Write Requests/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Flash Cache Internal Writes statistics">
          <tr>
            <td></td><td></td>
            <th class="exa" colspan="7">Population Write Requests/s</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa" colspan="2" rowspan="2">Trim Requests/s</th>
            </xsl:if>
            <th class="exa" colspan="7">Population Write MB/s</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa" colspan="2" rowspan="2">Trim MB/s</th>
            </xsl:if>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Columnar</th>
            <th class="exa" colspan="2">Keep</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Columnar</th>
            <th class="exa" colspan="2">Keep</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
            </xsl:if>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <xsl:if test="$showFcTrims = 'Y'">
              <th class="exa">1st</th>
              <th class="exa">2nd</th>
            </xsl:if>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_fc_iwrites">
    <tr class="exa">
      <!-- get cell name-->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data columns requests -->
      <xsl:if test="not(stat[@name='fciowpop'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciowpop']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fcciowpop'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcciowpop']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fckpiowpop'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fckpiowpop']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>

      <xsl:if test="$showFcTrims = 'Y'">
        <xsl:if test="not(stat[@name='fciowtrim'])">
          <td></td><td class="exabr"></td>
        </xsl:if>
        <xsl:apply-templates select="./stat[@name='fciowtrim']" mode="top_attr">
          <xsl:with-param name="attrName" select="'rqps'"/>
          <xsl:with-param name="diffAttrName" select="'rqps'"/>
        </xsl:apply-templates>
      </xsl:if>

      <!-- data columns mbps -->
      <xsl:if test="not(stat[@name='fciowpop'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fciowpop']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fcciowpop'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fcciowpop']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='fckpiowpop'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='fckpiowpop']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>

      <xsl:if test="$showFcTrims = 'Y'">
        <xsl:if test="not(stat[@name='fciowtrim'])">
          <td></td><td class="exabr"></td>
        </xsl:if>
        <xsl:apply-templates select="./stat[@name='fciowtrim']" mode="top_attr">
          <xsl:with-param name="attrName" select="'mbps'"/>
          <xsl:with-param name="diffAttrName" select="'mbps'"/>
        </xsl:apply-templates>
      </xsl:if>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- RAM Cache                                                    -->
  <xsl:template match="//cellstats[@type='dd_rc_spc']" mode="top">
    <a name="CELL_RAM_CACHE_SPACE"/>
    <h4 class="exa">Memory Cache Space Usage</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_rc_spc']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Space</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Memory Cache Space Usage statistics">
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Space Usage (MB)</th>
            <th class="exa" colspan="2">%OLTP</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_rc_spc">
    <tr class="exa">
      <!-- get cell name-->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <xsl:if test="not(stat[@name='rcby'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rcby']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'spcmb'"/>
        <xsl:with-param name="diffAttrName" select="'spcmb'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='rcbyo'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rcbyo']" mode="top_attr">
        <xsl:with-param name="attrName" select="'eff'"/>
        <xsl:with-param name="diffAttrName" select="'eff'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <xsl:template match="//cellstats[@type='dd_rc_ureads']" mode="top">
    <a name="CELL_RAM_CACHE_UREADS"/>
    <h4 class="exa">Memory Cache User Reads</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_rc_ureads']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Hits/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Memory Cache User Reads statistics">
          <tr>
            <td></td><td></td>
            <td></td><td></td><td></td>
            <th class="exa" colspan="5">Read Requests/s</th>
            <th class="exa" colspan="5">Read MB/s</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">%Hit</th>
            <th class="exa" colspan="3">Total Hits</th>
            <th class="exa" colspan="2">Misses</th>
            <th class="exa" colspan="3">Total Hits</th>
            <th class="exa" colspan="2">Misses</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_rc_ureads">
    <tr class="exa">
      <!-- get cell name-->
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data columns requests -->
      <xsl:if test="not(stat[@name='rcior'])">
        <td></td><td></td><td class="exabr"></td>
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rcior']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'eff'"/>
        <xsl:with-param name="diffAttrName" select="'eff'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='rcior']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='rciorm'])">
        <td></td><td class="exabr"></td>        
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rciorm']" mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='rcior'])">
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rcior']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:if test="not(stat[@name='rciorm'])">
        <td></td><td class="exabr"></td>        
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rciorm']" mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <xsl:template match="//cellstats[@type='dd_rc_iwrites']" mode="top">
    <a name="CELL_RAM_CACHE_IWRITES"/>
    <h4 class="exa">Memory Cache Internal Writes</h4>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_rc_iwrites']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Hits/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of Memory Cache Internal Write statistics">
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" colspan="3">Population Write Requests/s</th>
            <th class="exa" colspan="3">Population Write MB/s</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_rc_iwrites">
    <tr class="exa">
      <xsl:if test="not(./stat[@name='meta'])">
        <td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='meta']" mode="top_meta_info"/>
      <!-- data columns requests -->
      <xsl:if test="not(stat[@name='rciowpop'])">
        <td></td><td></td><td class="exabr"></td>
        <td></td><td></td><td class="exabr"></td>
      </xsl:if>
      <xsl:apply-templates select="./stat[@name='rciowpop']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="./stat[@name='rciowpop']" mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- IO Reasons by Requests                                       -->
  <xsl:template match="//cellstats[@type='dd_ioreason_rq']" mode="top">
    <a name="CELL_IOREASON_REQ"/>
    <h3 class="exa">Top IO Reasons by Requests</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_ioreason_rq']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Requests/s</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">Only reasons that are in the top <xsl:value-of select="$topReason"/> of either period are displayed</li>
          <li class="exa">Reasons ordered in descending order of absolute value of %Cell Diff of requests</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of IO Reasons by Requests statistics">
          <tr>
            <td></td><td></td>
            <td></td>
            <th class="exa" colspan="8">Requests</th>
            <td></td><td></td>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" rowspan="2">Reason Name</th>
            <th class="exa" colspan="3">% Cell</th>
            <th class="exa" colspan="2">Rank</th>
            <th class="exa" colspan="3">per Second</th>
            <th class="exa" colspan="2">MB/s</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_ioreason_rq">
    <xsl:apply-templates select="./stat[@name != 'meta']" mode="ioreason_rq"/>
  </xsl:template>

  <xsl:template match="stat" mode="ioreason_rq">
    <xsl:variable name="reasonName">
      <xsl:value-of select="./@name"/>
    </xsl:variable>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="../@rank != 1 and position() = 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <xsl:choose>
        <!-- display cell names for first reason -->
        <xsl:when test="position() = 1">
          <xsl:apply-templates select="../stat[@name='meta']" mode="top_meta_info"/>
        </xsl:when>
        <xsl:otherwise>
          <td></td><td class="exabr"/>          
        </xsl:otherwise>
      </xsl:choose>
      <td><xsl:value-of select="$reasonName"/></td>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct_rq'"/>
        <xsl:with-param name="diffAttrName" select="'pct_rq'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rn_rq'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- IO Reasons by MB                                             -->
  <xsl:template match="//cellstats[@type='dd_ioreason_mb']" mode="top">
    <a name="CELL_IOREASON_MB"/>    
    <h3 class="exa">Top IO Reasons by MB</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_ioreason_mb']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of MB/s</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">Only reasons that are in the top <xsl:value-of select="$topReason"/> of either period are displayed</li>
          <li class="exa">Reasons ordered in descending order of %Cell Diff of MB</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of IO Reasons by MB statistics">
          <tr>
            <td></td><td></td>
            <td></td>
            <th class="exa" colspan="8">MB</th>
            <td></td><td></td>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" rowspan="2">Reason Name</th>
            <th class="exa" colspan="3">% Cell</th>
            <th class="exa" colspan="2">Rank</th>
            <th class="exa" colspan="3">per Second</th>
            <th class="exa" colspan="2">Requests/s</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>        
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_ioreason_mb">
    <xsl:apply-templates select="./stat[@name != 'meta']" mode="ioreason_mb"/>
  </xsl:template>

  <xsl:template match="stat" mode="ioreason_mb">
    <xsl:variable name="reasonName">
      <xsl:value-of select="./@name"/>
    </xsl:variable>
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="../@rank != 1 and position() = 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <xsl:choose>
        <!-- display cell names for first reason -->
        <xsl:when test="position() = 1">
          <xsl:apply-templates select="../stat[@name='meta']" mode="top_meta_info"/>
        </xsl:when>
        <xsl:otherwise>
          <td></td><td class="exabr"/>          
        </xsl:otherwise>
      </xsl:choose>
      <td><xsl:value-of select="$reasonName"/></td>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct_by'"/>
        <xsl:with-param name="diffAttrName" select="'pct_by'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rn_by'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Top Databases by Requests                                    -->
  <xsl:template match="//cellstats[@type='dd_topdb_rq']" mode="top">
    <a name="CELL_TOPDB_REQ"/>
    <h3 class="exa">Top Databases by Requests</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_topdb_rq']/stat">
        <ul>
          <li class="exa">Only databases that are in the top <xsl:value-of select="$topDbs"/> of either period are displayed</li>
          <li class="exa">Ordered in descending order of absolute value of %Captured Diff</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top databases by requests">
          <tr>
            <td></td>
            <th class="exa" colspan="12">Requests/s</th>
            <th class="exa" colspan="6">MB/s</th>
          </tr>
          <tr>
            <td></td>
            <th class="exa" colspan="3">%Captured</th>
            <th class="exa" colspan="2">Rank</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
          </tr>
          <tr>
            <th class="exa">DB Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./stat" mode="topdb_rq"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>                
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="stat" mode="topdb_rq">
    <!-- first display database name -->
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct_rq'"/>
        <xsl:with-param name="diffAttrName" select="'pct_rq'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rn_rq'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'frqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'drqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'fmbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'dmbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Top Databases by MB                                          -->
  <xsl:template match="//cellstats[@type='dd_topdb_mb']" mode="top">
    <a name="CELL_TOPDB_MB"/>
    <h3 class="exa">Top Databases by Throughput</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_topdb_mb']/stat">
        <ul>
          <li class="exa">Only databases that are in the top <xsl:value-of select="$topDbs"/> of either period are displayed</li>
          <li class="exa">Ordered in descending order of absolute value of %Captured Diff</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top databases by throughput">
          <tr>
            <td></td>
            <th class="exa" colspan="12">MB/s</th>
            <th class="exa" colspan="6">Requests/s</th>
          </tr>
          <tr>
            <td></td>
            <th class="exa" colspan="3">%Captured</th>
            <th class="exa" colspan="2">Rank</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
          </tr>
          <tr>
            <th class="exa">DB Name</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./stat" mode="topdb_mb"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>                
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="stat" mode="topdb_mb">
    <!-- first display database name -->
    <tr class="exa">
      <td><xsl:value-of select="./@name"/></td>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct_mb'"/>
        <xsl:with-param name="diffAttrName" select="'pct_mb'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rn_mb'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'fmbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'dmbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'frqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'drqps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Top Databases by Requests per Cell                           -->
  <xsl:template match="//cellstats[@type='dd_dbpercell_rq']" mode="top">
    <a name="CELL_TOPDB_REQ_CELL"/>
    <h3 class="exa">Top Databases by Requests per Cell</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_dbpercell_rq']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of Requests/s</li>
          <li class="exa">Only databases that are in the top <xsl:value-of select="$topDbPerCell"/> of each cell are displayed </li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top databases by requests per cell">
          <tr>
            <td></td><td></td><td></td>
            <th class="exa" colspan="12">Requests/s</th>
            <th class="exa" colspan="6">MB/s</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" rowspan="2">DB Name</th>
            <th class="exa" colspan="3">%Cell</th>
            <th class="exa" colspan="2">Rank</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>                
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_dbpercell_rq">
    <!-- retrieve database names -->
    <xsl:apply-templates select="./stat[@name != 'meta']" mode="dbpercell_rq"/>
  </xsl:template>

  <xsl:template match="stat" mode="dbpercell_rq">
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="../@rank != 1 and position() = 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <xsl:choose>
        <!-- only display cell name for first row -->
        <xsl:when test="position() = 1">
          <xsl:apply-templates select="../stat[@name='meta']" mode="top_meta_info"/>
        </xsl:when>
        <xsl:otherwise>
          <td></td><td class="exabr"></td>
        </xsl:otherwise>
      </xsl:choose>
      <td><xsl:value-of select="./@name"/></td>
      <!-- requests -->
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct_rq'"/>
        <xsl:with-param name="diffAttrName" select="'pct_rq'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rn_rq'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'rqps'"/>
        <xsl:with-param name="diffAttrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'frqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'drqps'"/>
      </xsl:apply-templates>
      <!-- now display MB/s -->
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'fmbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'dmbps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

  <!-- ============================================================ -->
  <!-- Top Databases by MB per Cell                                 -->
  <xsl:template match="//cellstats[@type='dd_dbpercell_mb']" mode="top">
    <a name="CELL_TOPDB_MB_CELL"/>
    <h3 class="exa">Top Databases by Throughput per Cell</h3>
    <xsl:choose>
      <xsl:when test="//cellstats[@type='dd_dbpercell_mb']/cells/*">
        <ul>
          <li class="exa">Comparison Pairs: Cells are compared in descending order of MB/s</li>
        </ul>
        <table class="exa" border="0" summary="This table displays the comparison of top databases by throughput per cell">
          <tr>
            <td></td><td></td><td></td>
            <th class="exa" colspan="12">MB/s</th>
            <th class="exa" colspan="6">Requests/s</th>
          </tr>
          <tr>
            <th class="exa" colspan="2">Cell Name</th>
            <th class="exa" rowspan="2">DB Name</th>
            <th class="exa" colspan="3">%Cell</th>
            <th class="exa" colspan="2">Rank</th>
            <th class="exa" colspan="3">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
            <th class="exa" colspan="2">Total</th>
            <th class="exa" colspan="2">Flash</th>
            <th class="exa" colspan="2">Disk</th>
          </tr>
          <tr>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">%Diff</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
            <th class="exa">1st</th>
            <th class="exa">2nd</th>
          </tr>
          <xsl:apply-templates select="./cells" mode="diff_generic"/>
        </table>
      </xsl:when>
      <xsl:otherwise>
        <p><xsl:value-of select="$noDataMsg"/></p>                
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template>

  <xsl:template match="cell" mode="diff_dbpercell_mb">
    <xsl:apply-templates select="./stat[@name != 'meta']" mode="dbpercell_mb"/>
  </xsl:template>

  <xsl:template match="stat" mode="dbpercell_mb">
    <tr>
      <xsl:attribute name="class">
        <xsl:value-of select="'exa'"/>
        <xsl:if test="../@rank != 1 and position() = 1">
          <xsl:value-of select="' exat'"/>
        </xsl:if>
      </xsl:attribute>
      <!-- only display cell name for first row -->
      <xsl:choose>
        <xsl:when test="position() = 1">
          <xsl:apply-templates select="../stat[@name='meta']" mode="top_meta_info"/>
        </xsl:when>
        <xsl:otherwise>
          <td></td><td class="exabr"/>
        </xsl:otherwise>        
      </xsl:choose>
      <td><xsl:value-of select="./@name"/></td>
      <!-- MB/s -->
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'pct_mb'"/>
        <xsl:with-param name="diffAttrName" select="'pct_mb'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rn_mb'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr_diff">
        <xsl:with-param name="attrName" select="'mbps'"/>
        <xsl:with-param name="diffAttrName" select="'mbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'fmbps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'dmbps'"/>
      </xsl:apply-templates>
      <!-- requests -->
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'rqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'frqps'"/>
      </xsl:apply-templates>
      <xsl:apply-templates select="." mode="top_attr">
        <xsl:with-param name="attrName" select="'drqps'"/>
      </xsl:apply-templates>
    </tr>
  </xsl:template>

</xsl:stylesheet>


OHA YOOOO