<?xml version="1.0" encoding="windows-1250"?>
<xsl:stylesheet id="Flag 2"   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   xmlns:msxsl="urn:schemas-microsoft-com:xslt"  xmlns:user="urn:my-scripts"  xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel"  xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"  xmlns:exslt="http://exslt.org/common"   version="1.0">
  <xsl:output method="xml" indent="yes" />
  <!--  -->
  <xsl:key name="stdrep" match="MasterPlexPlateData/BeadInfo[1]/StandardCurve/DataSeries/StdWell" use="@stdconc" />
  <xsl:template match="/">
    <xsl:for-each select="MasterPlexPlateData">
      <!-- -->
      <xsl:variable name="MasterPlexPlateData">
        <xsl:copy-of select="/" />
        <xsl:for-each select="BeadInfo/StandardCurve/DataSeries/StdWell[generate-id(.)=generate-id(key('stdrep', @stdconc)[1])]">
          <xsl:sort select="@stdconc" data-type="number" order="descending"/>
          <xsl:element name="StandardGroup2">
            <xsl:attribute name="name">S<xsl:number value ="position()"/></xsl:attribute>
            <xsl:for-each select="key('stdrep', @stdconc)">
              <xsl:element name="GroupWell">
                <xsl:attribute name="id">
                  <xsl:value-of select="@wellid"/>
                </xsl:attribute>
               <xsl:attribute name="stdconc">
                  <xsl:value-of select="@stdconc"/>
                </xsl:attribute> 
              </xsl:element>
            </xsl:for-each>
          </xsl:element>
        </xsl:for-each>
      </xsl:variable>
      
      <xsl:variable name="bkgnum">
      	<xsl:value-of select="count(msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BkgGroupList/BkgGroup)" />
      </xsl:variable>
      <xsl:variable name="stdnum">
      	<xsl:value-of select="count(msxsl:node-set($MasterPlexPlateData)/StandardGroup2)" />
      </xsl:variable>
      <xsl:variable name="unknum">
      	<xsl:value-of select="count(msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/UnknowGroupList/UnknowGroup)" />
      </xsl:variable>
      <xsl:variable name="ctlnum">
      	<xsl:value-of select="count(msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/ControlGroupList/ControlGroup)" />
      </xsl:variable>
      <xsl:variable name="repnum">
       <xsl:value-of select="$bkgnum + $stdnum + $unknum + $ctlnum" />
      </xsl:variable>
      <xsl:variable name="wellnum">
      	<xsl:value-of select="count(msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/Well)" />
      </xsl:variable>
      	
      <!-- <xsl:text disable-output-escaping="yes">&lt;?xml version="1.0" encoding="UTF-16"?&gt;</xsl:text>-->
    <xsl:text disable-output-escaping="yes">&lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"&gt;</xsl:text>
    <Styles>
      <Style ss:ID="Default" ss:Name="Normal">
        <Alignment ss:Vertical="Bottom"/>
        <Borders/>
        <Font/>
        <Interior/>
        <NumberFormat/>
        <Protection/>
      </Style>
      <Style ss:ID="m108058916">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Size="12" ss:Color="#3366FF" ss:Bold="1"/>
        <Interior ss:Color="#CCCCFF" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="m108058917">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Size="12" ss:Color="#3366FF" ss:Bold="1"/>
        <Interior ss:Color="#CCCCFF" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="m108058917b">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Size="12" ss:Color="#3366FF" ss:Bold="1"/>
        <Interior ss:Color="#FFFF00" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="m108058918">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Size="12" ss:Color="#3366FF" ss:Bold="1"/>
        <Interior ss:Color="#CCCCFF" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="m160773032">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Size="12" ss:Color="#3366FF" ss:Bold="1"/>
        <Interior ss:Color="#CCCCFF" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s62">
        <Font x:Family="Swiss" ss:Bold="1"/>
      </Style>
      <Style ss:ID="s63">
        <Font x:Family="Swiss" ss:Size="14" ss:Bold="1"/>
      </Style>
      <Style ss:ID="s64">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
      </Style>
      <Style ss:ID="s65">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s66">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Bold="1"/>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s67">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Bold="1"/>
      </Style>
      <Style ss:ID="s68">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Bold="1"/>
      </Style>
      <Style ss:ID="s69">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s70">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s71">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s72">
        <Font x:Family="Swiss" ss:Size="12" ss:Bold="1"/>
      </Style>
      <Style ss:ID="s73">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s74">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s75">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s76">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s77">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s78">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s79">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s80">
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s81">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s82">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
      </Style>
      <Style ss:ID="s84">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s85">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s86">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Bold="1" />
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s87">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s88">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s89">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s90">
        <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss"/>
        <Interior/>
      </Style>
      <Style ss:ID="s91">
        <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
      </Style>
      <Style ss:ID="s92">
        <Font x:Family="Swiss"/>
      </Style>
      <Style ss:ID="s93">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Font x:Family="Swiss" ss:Color="#FF0000"/>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s97">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s98">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s99">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s100">
        <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s101">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s102">
        <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Font x:Family="Swiss"/>
        <Interior/>
      </Style>
      <Style ss:ID="s103">
        <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s104">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Interior/>
      </Style>
      <Style ss:ID="s105">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Interior/>
      </Style>
      <Style ss:ID="s106">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Interior/>
      </Style>
      <Style ss:ID="s107">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
      </Style>
      <Style ss:ID="s108">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
        <Font x:Family="Swiss" ss:Bold="1"/>
      </Style>
      <Style ss:ID="s109">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
        <Font x:Family="Swiss" ss:Bold="1"/>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s110">
        <Borders>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s111">
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s112">
        <Borders/>
        <NumberFormat ss:Format="Scientific"/>
      </Style>
      <Style ss:ID="s113">
        <Borders/>
      </Style>
      <Style ss:ID="s114">
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s115">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders/>
        <Font x:Family="Swiss"/>
      </Style>
      <Style ss:ID="s116">
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s117">
        <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s118">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s119">
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s120">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s121">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s122">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="1"/>
        </Borders>
      </Style>
      <Style ss:ID="s124">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s125">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s126">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s127">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s128">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s129">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
      </Style>
      <Style ss:ID="s130">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s131">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s132">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Interior ss:Color="#C0C0C0" ss:Pattern="Solid"/>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s133">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Font ss:FontName="Times New Roman" x:Family="Roman" ss:Size="11"     ss:Color="#000000"/>
      </Style>
      <Style ss:ID="s134">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Font ss:FontName="Times New Roman" x:Family="Roman" ss:Size="11"     ss:Color="#000000"/>
      </Style>
      <Style ss:ID="s135">
        <Alignment ss:Horizontal="Left" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Font ss:FontName="Times New Roman" x:Family="Roman" ss:Size="11"     ss:Color="#000000"/>
      </Style>
      <Style ss:ID="s139">
        <NumberFormat ss:Format="Scientific"/>
      </Style>
      <Style ss:ID="s140">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"/>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"/>
        </Borders>
        <Font x:Family="Swiss"/>
      </Style>
      <Style ss:ID="s1075">
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s1084">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s1085">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Bottom" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
          <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
      <Style ss:ID="s1086">
        <Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>
        <Borders>
          <Border ss:Position="Top" ss:LineStyle="Continuous" ss:Weight="2"      ss:Color="#000000"/>
        </Borders>
        <NumberFormat ss:Format="Fixed"/>
      </Style>
    </Styles>
    <!--<Workbook>-->
    <!--<xsl:for-each select="MasterPlexPlateData/BeadInfo">-->
    <xsl:element name="Worksheet">
      <xsl:attribute name="ss:Name">Conc. Summary</xsl:attribute>
      <Table>
        <Column ss:Index="2" ss:AutoFitWidth="1"/>
        
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
   <Column ss:AutoFitWidth="1"/>
        <Row ss:Height="15.75">
          <Cell ss:StyleID="s72">
            <Data ss:Type="String">Summary Report</Data>
          </Cell>
          
        </Row>
        <Row ss:Index="3">
          <Cell ss:Index="2" ss:StyleID="s62">
            <Data ss:Type="String">Sample Range Checking</Data>
          </Cell>
        </Row>
        <Row ss:Height="13.5">
          <Cell ss:Index="2">
            <Data ss:Type="String">Note: Sample Range Checking Calculations are performed on concentrations that have not been dilution factor corrected</Data>
          </Cell>
        </Row>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s73">
            <Data ss:Type="String">Limits</Data>
          </Cell>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
              
           <Cell ss:StyleID="s74">
              <Data ss:Type="String">
                <xsl:value-of select="@beadname"/>
        
              </Data>
            </Cell> 
            
          </xsl:for-each>
        </Row>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s73"/>
        <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
              
           <Cell ss:StyleID="s74">
              <Data ss:Type="String"><xsl:value-of select="StandardCurve/@stdunit"/>
              </Data>
            </Cell> 
            
          </xsl:for-each>
        </Row>
        <Row>
          <Cell ss:Index="2" ss:StyleID="s79">
            <Data ss:Type="String">Lowest Curve Point</Data>
          </Cell>
          <xsl:for-each select="BeadInfo">
            <xsl:variable name="temp">
              <xsl:for-each select="StandardCurve/DataSeries/StdWell">
                <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                <xsl:element name="stdconc">
                  <xsl:value-of select="@stdconc"/>
                </xsl:element>
                <!--	 --></xsl:for-each>
            </xsl:variable>
            <Cell ss:StyleID="s1075">
              <Data ss:Type="Number">
                <xsl:value-of select="msxsl:node-set($temp)/stdconc[1]"/>
              </Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s81">
            <Data ss:Type="String">Highest Curve Point</Data>
          </Cell>
          <xsl:for-each select="BeadInfo">
            <xsl:variable name="temp">
              <xsl:for-each select="StandardCurve/DataSeries/StdWell">
                <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                <xsl:element name="stdconc">
                  <xsl:value-of select="@stdconc"/>
                </xsl:element>
                <!--	 --></xsl:for-each>
            </xsl:variable>
            <Cell ss:StyleID="s1084">
              <Data ss:Type="Number">
                <xsl:value-of select="msxsl:node-set($temp)/stdconc[1]"/>
              </Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
        <Row ss:Height="40">
          <Cell ss:Index="2" ss:StyleID="s90">
            <Data ss:Type="String">Lower Limit of detection</Data>
          </Cell>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <xsl:variable name="bkg">
              <xsl:value-of select="@bkgvalue" />
            </xsl:variable>
            <xsl:variable name="beadid">
              <xsl:value-of select="@id" />
            </xsl:variable>
            <xsl:variable name="stddev">
              <xsl:value-of select="../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
            </xsl:variable>
            <xsl:variable name="llod">
              <xsl:value-of  select="(3 * $stddev) + $bkg" />
            </xsl:variable>
            <Cell ss:StyleID="s1084">
              <Data ss:Type="Number"></Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
        <Row ss:Height="40">
          <Cell ss:Index="2" ss:StyleID="s90">
            <Data ss:Type="String">%CV Cutoff</Data>
          </Cell>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s1084">
              <Data ss:Type="Number">20</Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
        <Row>
          <Cell ss:Index="3" ss:StyleID="s113"/>
        </Row>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s62">
            <Data ss:Type="String">Sample Summary</Data>
          </Cell>
          <Cell ss:StyleID="s113"/>
        </Row>
        <Row ss:AutoFitHeight="0" ss:Height="15">
          <Cell ss:Index="2" ss:MergeAcross="5" ss:StyleID="m108058916">
            <ss:Data       ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
              <B>Key</B>
            </ss:Data>
          </Cell>
        </Row>
        <Row ss:AutoFitHeight="0" ss:Height="13.5">
          <Cell ss:Index="2" ss:MergeAcross="5" ss:StyleID="m108058917">
            <ss:Data       ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
              <Font        html:Size="10" html:Color="#3366FF">&#10;</Font>
              <Font html:Size="10">Bold type indicates extrapolated value</Font>
            </ss:Data>
          </Cell>
        </Row>
        <Row ss:AutoFitHeight="0" ss:Height="13.5">
          <Cell ss:Index="2" ss:MergeAcross="5" ss:StyleID="m108058917b">
            <ss:Data       ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
              <Font        html:Size="10" html:Color="#FFFF00">&#10;</Font>
              <Font html:Size="10">%CV</Font>
            </ss:Data>
          </Cell>
        </Row>
        <Row ss:AutoFitHeight="0" ss:Height="13.5">
          <Cell ss:Index="2" ss:MergeAcross="5" ss:StyleID="m108058917">
            <ss:Data       ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
              <Font        html:Size="10" html:Color="#3366FF">&#10;</Font>
              <Font html:Size="10"        html:Color="#FF0000">Red values indicates value below Lower Limit Of Detection</Font>
            </ss:Data>
          </Cell>
        </Row>
        <Row ss:AutoFitHeight="0" ss:Height="13.5">
          <Cell ss:Index="2" ss:MergeAcross="5" ss:StyleID="m108058917">
            <ss:Data       ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
              <Font        html:Size="10" html:Color="#3366FF">&#10;</Font>
              <Font html:Size="10">&lt;OOR indicates value below background</Font>
            </ss:Data>
          </Cell>
        </Row>
        <Row ss:AutoFitHeight="0" ss:Height="13.5">
          <Cell ss:Index="2" ss:MergeAcross="5" ss:StyleID="m108058918">
            <ss:Data       ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
              <Font        html:Size="10" html:Color="#3366FF">&#10;</Font>
              <Font html:Size="10">&gt;OOR indicates saturated value</Font>
            </ss:Data>
          </Cell>
        </Row>
        <Row ss:Height="13.5"/>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s73">
            <Data ss:Type="String">SampleID</Data>
          </Cell>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s74">
              <Data ss:Type="String">
                <xsl:value-of select="@beadname"/>
              </Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
        <Row ss:Height="13.5">
         <Cell ss:Index="2" ss:StyleID="s73"/>
        <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s74">
              <Data ss:Type="String"><xsl:value-of select="StandardCurve/@stdunit"/>
              </Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
        
     
        <Row>
          <Cell ss:Index="2" ss:StyleID="s79"/>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s75"/>
          
          </xsl:for-each>
          <Cell ss:StyleID="s80"/>
        </Row>
        <Row>
          <Cell ss:Index="2" ss:StyleID="s79"/>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s84"/>
            
          </xsl:for-each>
          <Cell ss:StyleID="s85"/>
        </Row>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s81"/>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s1084"/>
            
          </xsl:for-each>
          <Cell ss:StyleID="s85"/>
        </Row>
        <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/StandardGroup2">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
                <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="$conavg" />
                </xsl:call-template>
                
              </xsl:for-each>
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <xsl:for-each select="/MasterPlexPlateData/BkgGroupList/BkgGroup">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
                <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="$conavg" />
                </xsl:call-template>
                
              </xsl:for-each>
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <xsl:for-each select="/MasterPlexPlateData/UnknowGroupList/UnknowGroup">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
                <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="$conavg" />
                </xsl:call-template>
               </xsl:for-each> 
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <xsl:for-each select="/MasterPlexPlateData/ControlGroupList/ControlGroup">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
               <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="$conavg" />
                </xsl:call-template>
                
              </xsl:for-each>
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <Row>
          <Cell ss:Index="2" ss:StyleID="s1086"/>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s1086"/>
            
          </xsl:for-each>
        </Row>
      <!-- CV Section -->
      <Row ss:Index="122" ss:Height="13.5"/>
        <Row ss:Height="13.5">
          <Cell ss:Index="2" ss:StyleID="s73">
            <Data ss:Type="String">SampleID</Data>
          </Cell>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s74">
              <Data ss:Type="String">
                <xsl:value-of select="@beadname"/>
                <xsl:text> %CV</xsl:text>
                
              </Data>
            </Cell>
            
          </xsl:for-each>
        </Row>
       
        <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/StandardGroup2">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
                <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="@concv * 100" />
                </xsl:call-template>
                
              </xsl:for-each>
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <xsl:for-each select="/MasterPlexPlateData/BkgGroupList/BkgGroup">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
               <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="@concv * 100" />
                </xsl:call-template>
                
              </xsl:for-each>
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <xsl:for-each select="/MasterPlexPlateData/UnknowGroupList/UnknowGroup">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
                <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="@concv * 100" />
                </xsl:call-template>
               </xsl:for-each> 
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <xsl:for-each select="/MasterPlexPlateData/ControlGroupList/ControlGroup">
          <Row>
            <Cell>
              <Data ss:Type="String"></Data>
            </Cell>
            
            <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
              <Data ss:Type="String">
                <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
              </Data>
            </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead">
                <xsl:variable name="beadid">
                  <xsl:value-of select="@id" />
                </xsl:variable>
                <xsl:variable name="conavg">
                  <xsl:choose>
                    <xsl:when test="@constr = ''">
                      <xsl:value-of select="@conavg"/>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="@constr"/>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:variable>
                <xsl:variable name="high">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="low">
                  <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                    <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                    <xsl:element name="stdconc">
                      <xsl:value-of select="@stdconc"/>
                    </xsl:element>
                  </xsl:for-each>
                </xsl:variable>
                <xsl:variable name="bkg">
                  <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                </xsl:variable>
                <xsl:variable name="stddev">
                  <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                </xsl:variable>
                <xsl:variable name="llod">
                  <xsl:value-of  select="(3 * $stddev) + $bkg" />
                </xsl:variable>
                <xsl:call-template name="stringtestb">
                  <xsl:with-param name="string" select="@concv * 100" />
                </xsl:call-template>
                
              </xsl:for-each>
            </xsl:for-each>
          </Row>
        </xsl:for-each>
        <Row>
          <Cell ss:Index="2" ss:StyleID="s1086"/>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">
            <Cell ss:StyleID="s1086"/>
             
          </xsl:for-each>
        </Row>
      <!--End CV Section-->  
      </Table>
      
    <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/MasterPlexPlateData/BeadInfo">  
       
  
  
      </xsl:for-each>
    
   <xsl:text disable-output-escaping="yes">&lt;ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel"&gt;</xsl:text>
  		
   <Range>R25C3:R121C103</Range>
    <Condition>
    <Qualifier>Less</Qualifier>
    <Value1>R9C</Value1>
    <Format Style='color:red'/>
   </Condition>
   <Condition>
    <Qualifier>NotBetween</Qualifier>
    <Value1>R7C</Value1>
    <Value2>R8C</Value2>
    <Format Style='font-weight:700'/>
   </Condition>
    <xsl:text disable-output-escaping="yes">&lt;/ConditionalFormatting&gt;</xsl:text>
    <ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel">
   <Range>R25C3:R121C103</Range>
   <Condition>
    <Value1>R[99]C&gt;R10C</Value1>
    <Format Style='background:yellow'/>
   </Condition>
  </ConditionalFormatting>
 <!--  <ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel">
   <Range>R25C3:R121C103</Range>
   <Condition>
    <Value1>R[99]C=&quot;***&quot;</Value1>
    <Format Style='mso-background-source:auto'/>
   </Condition>
  </ConditionalFormatting> -->
  
     
    
    </xsl:element>
    <xsl:for-each select="BeadInfo/StandardCurve">
      <xsl:variable name="beadid">
        <xsl:value-of select="../@id" />
      </xsl:variable>
      <xsl:element name="Worksheet">
        <xsl:attribute name="ss:Name">
          <xsl:value-of select="../@beadname" />
        </xsl:attribute>
        <Table>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
   <Column ss:AutoFitWidth="0" ss:Width="85"/>
  <Row>
  
            <Cell ss:StyleID="s63">
              <Data ss:Type="String">
                <xsl:value-of select="../@beadname" />
              </Data>
            </Cell>
          </Row>
          <Row ss:Index="3">
            <Cell ss:Index="2">
              <Data ss:Type="String">MFI Calculation</Data>
            </Cell>
            <Cell ss:Index="4">
              <Data ss:Type="String">Background Subtracted MFI</Data>
            </Cell>
          </Row>
          <xsl:variable name ="weight">
            <xsl:choose>
              <xsl:when test="@useweight = 1">
                <xsl:choose>
                  <xsl:when test="@weightmethod = 0">
                    <xsl:value-of select="'1/Y^2'"/>
                  </xsl:when>
                  <xsl:when test="@weightmethod = 1">
                    <xsl:value-of select="'1/Y'"/>
                  </xsl:when>
                  <xsl:when test="@weightmethod = 2">
                    <xsl:value-of select="'1/X^2'"/>
                  </xsl:when>
                  <xsl:when test="@weightmethod = 3">
                    <xsl:value-of select="'1/X'"/>
                  </xsl:when>
                  <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
              </xsl:when>
              <xsl:otherwise></xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <xsl:variable name ="equationname">
            <xsl:choose>
              <xsl:when test="@equationname = 'Five Parameter Logistics'">
                <xsl:value-of select="'5PL'"/>
              </xsl:when>
              <xsl:when test="@equationname = 'Four Parameter Logistics'">
                <xsl:value-of select="'4PL'"/>
              </xsl:when>
              <xsl:otherwise>
                <xsl:value-of select="@equationname"/>
              </xsl:otherwise>
            </xsl:choose>
          </xsl:variable>
          <Row ss:Index="5">
            <Cell ss:Index="2">
              <Data ss:Type="String">Curve Fit</Data>
            </Cell>
            <Cell>
              <Data ss:Type="String">
                <xsl:value-of select="$equationname"/>
                <xsl:value-of select="$weight"/>
              </Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:Index="2">
              <Data ss:Type="String">Equation</Data>
            </Cell>
            <Cell>
              <Data ss:Type="String">
                <xsl:value-of select="@equationexpression"/>
              </Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:Index="2">
              <Data ss:Type="String">Parameters</Data>
            </Cell>
            <Cell>
              <Data ss:Type="String">A =<xsl:call-template name="Scientific"><xsl:with-param name="Num" select="Parameter[@paraid = 0]/@value" /></xsl:call-template>, B =<xsl:call-template name="Scientific"><xsl:with-param name="Num" select="Parameter[@paraid = 1]/@value" /></xsl:call-template>, C =<xsl:call-template name="Scientific"><xsl:with-param name="Num" select="Parameter[@paraid = 2]/@value" /></xsl:call-template>, D =<xsl:call-template name="Scientific"><xsl:with-param name="Num" select="Parameter[@paraid = 3]/@value" /></xsl:call-template>,E =<xsl:call-template name="Scientific"><xsl:with-param name="Num" select="Parameter[@paraid = 4]/@value" /></xsl:call-template>
              </Data>
            </Cell>
          </Row>
          <Row ss:Index="9">
            <Cell ss:Index="2" ss:StyleID="s62">
              <Data ss:Type="String">Sample Range Checking Limits</Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:Index="2">
              <Data ss:Type="String">Lower Limit</Data>
            </Cell>
            <xsl:variable name="low">
              <xsl:for-each select="DataSeries/StdWell">
                <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                <xsl:element name="stdconc">
                  <xsl:value-of select="@stdconc"/>
                </xsl:element>
                <!--	 --></xsl:for-each>
            </xsl:variable>
            <Cell>
              <Data ss:Type="Number">
                <xsl:value-of select="msxsl:node-set($low)/stdconc[1]"/>
              </Data>
            </Cell>
          </Row>
          <Row>
            <Cell ss:Index="2">
              <Data ss:Type="String">Upper Limit</Data>
            </Cell>
            <xsl:variable name="high">
              <xsl:for-each select="DataSeries/StdWell">
                <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                <xsl:element name="stdconc">
                  <xsl:value-of select="@stdconc"/>
                </xsl:element>
                <!--	 --></xsl:for-each>
            </xsl:variable>
            <Cell>
              <Data ss:Type="Number">
                <xsl:value-of select="msxsl:node-set($high)/stdconc[1]"/>
              </Data>
            </Cell>
          </Row>
       <Row>
    <Cell ss:Index="2"><Data ss:Type="String">LLOD</Data></Cell>
   <xsl:text disable-output-escaping="yes">&lt;Cell ss:Formula="='Conc. Summary'!R[-3]C[</xsl:text><xsl:value-of select="$beadid" /><xsl:text disable-output-escaping="yes">]"&gt;</xsl:text>
    <Data ss:Type="Number"></Data>
    <xsl:text disable-output-escaping="yes">&lt;/Cell&gt;</xsl:text>
   </Row>
   <Row>
    <Cell ss:Index="2"><Data ss:Type="String">%CV</Data></Cell>
   <xsl:text disable-output-escaping="yes">&lt;Cell ss:Formula="='Conc. Summary'!R[-3]C[</xsl:text><xsl:value-of select="$beadid" /><xsl:text disable-output-escaping="yes">]"&gt;</xsl:text>
    <Data ss:Type="Number"></Data>
    <xsl:text disable-output-escaping="yes">&lt;/Cell&gt;</xsl:text>
   </Row> 
   <Row />
          <Row ss:Height="15.75">
            <Cell ss:Index="2" ss:StyleID="s72">
              <Data ss:Type="String">Summary</Data>
            </Cell>
            <Cell ss:Index="3">
              <Data ss:Type="String">*** = Values not calculable due to 1 or more failed replicates</Data>
            </Cell>
           
          </Row>
          <Row ss:Height="13.5"/>
          <Row ss:Height="13.5">
            <Cell ss:Index="2" ss:StyleID="s74">
              <Data ss:Type="String">SampleID</Data>
            </Cell>
            <Cell ss:StyleID="s74">
              <Data ss:Type="String">Mean MFI</Data>
            </Cell>
            <Cell ss:StyleID="s74">
              <Data ss:Type="String">Mean Concentration</Data>
            </Cell>
            <Cell ss:StyleID="s74">
              <Data ss:Type="String">CV%</Data>
            </Cell>
            <Cell ss:StyleID="s65">
              <Data ss:Type="String"># of Replicates</Data>
            </Cell>
          </Row>
          <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/StandardGroup2">
                  <xsl:variable name="countthis">
              <xsl:for-each select="GroupWell">
                <xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
                <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                  <xsl:choose>
                    <xsl:when test="@outlierbs=0">
                      <xsl:element name="n">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="id">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:element name="o">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="ido">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:variable>
            <xsl:variable name="n">
              <xsl:value-of select="count(msxsl:node-set($countthis)/n)" />
            </xsl:variable>
            <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              
                <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID2">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID2]/@name"/>
                </Data>
              </Cell>
              </xsl:for-each>
              <xsl:variable name="GroupWellID">
                <xsl:choose>
                  <xsl:when test="msxsl:node-set($countthis)/n">
                    <xsl:value-of select="msxsl:node-set($countthis)/id" />
                  </xsl:when>
                  <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
              <xsl:choose>
                <xsl:when test="$GroupWellID != ''">
                  <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]">
                    <xsl:variable name="conavg">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conavg"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <xsl:variable name="high">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="low">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="bkg">
                      <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                    </xsl:variable>
                    <xsl:variable name="stddev">
                      <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                    </xsl:variable>
                    <xsl:variable name="llod">
                      <xsl:value-of  select="(3 * $stddev) + $bkg" />
                    </xsl:variable>
                    <xsl:variable name="mfiavg">
                      <xsl:value-of  select="@sampleavg" />
                    </xsl:variable>
                    <xsl:variable name="concv">
                      <xsl:value-of  select="@concv * 100" />
                    </xsl:variable>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$mfiavg" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$conavg" />
                      <xsl:with-param name="bkg" select="$bkg" />
                      <xsl:with-param name="high" select="msxsl:node-set($high)/stdconc[1]" />
                      <xsl:with-param name="low" select="msxsl:node-set($low)/stdconc[1]" />
                      <xsl:with-param name="llod" select="$llod" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$concv" />
                    </xsl:call-template>
                  </xsl:for-each>
                  <!--    </xsl:for-each>-->
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(<xsl:value-of select="$n"/>)</Data>
                  </Cell>
                </xsl:when>
                <xsl:otherwise>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                 <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(0)</Data>
                  </Cell>
                </xsl:otherwise>
              </xsl:choose>
            </Row>
          </xsl:for-each>
          <xsl:for-each select="/MasterPlexPlateData/BkgGroupList/BkgGroup">
                      <xsl:variable name="countthis">
              <xsl:for-each select="GroupWell">
                <xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
                <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                  <xsl:choose>
                    <xsl:when test="@outlierbs=0">
                      <xsl:element name="n">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="id">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:element name="o">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="ido">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:variable>
            <xsl:variable name="n">
              <xsl:value-of select="count(msxsl:node-set($countthis)/n)" />
            </xsl:variable>
            <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID2">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID2]/@name"/>
                </Data>
              </Cell>
              </xsl:for-each>
              <xsl:variable name="GroupWellID">
                <xsl:choose>
                  <xsl:when test="msxsl:node-set($countthis)/n">
                    <xsl:value-of select="msxsl:node-set($countthis)/id" />
                  </xsl:when>
                  <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
              <xsl:choose>
                <xsl:when test="$GroupWellID != ''">
                  <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]">
                    <xsl:variable name="conavg">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conavg"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <xsl:variable name="high">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="low">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="bkg">
                      <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                    </xsl:variable>
                    <xsl:variable name="stddev">
                      <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                    </xsl:variable>
                    <xsl:variable name="llod">
                      <xsl:value-of  select="(3 * $stddev) + $bkg" />
                    </xsl:variable>
                    <xsl:variable name="mfiavg">
                      <xsl:value-of  select="@sampleavg" />
                    </xsl:variable>
                    <xsl:variable name="concv">
                      <xsl:value-of  select="@concv * 100" />
                    </xsl:variable>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$mfiavg" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$conavg" />
                      <xsl:with-param name="bkg" select="$bkg" />
                      <xsl:with-param name="high" select="msxsl:node-set($high)/stdconc[1]" />
                      <xsl:with-param name="low" select="msxsl:node-set($low)/stdconc[1]" />
                      <xsl:with-param name="llod" select="$llod" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$concv" />
                    </xsl:call-template>
                  </xsl:for-each>
                  <!--    </xsl:for-each>-->
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(<xsl:value-of select="$n"/>)</Data>
                  </Cell>
                </xsl:when>
                <xsl:otherwise>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                 <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(0)</Data>
                  </Cell>
                </xsl:otherwise>
              </xsl:choose>
            </Row>
          </xsl:for-each>
          <xsl:for-each select="/MasterPlexPlateData/UnknowGroupList/UnknowGroup">
                   <xsl:variable name="countthis">
              <xsl:for-each select="GroupWell">
                <xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
                <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                  <xsl:choose>
                    <xsl:when test="@outlierbs=0">
                      <xsl:element name="n">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="id">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:element name="o">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="ido">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:variable>
            <xsl:variable name="n">
              <xsl:value-of select="count(msxsl:node-set($countthis)/n)" />
            </xsl:variable>
            <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID2">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID2]/@name"/>
                </Data>
              </Cell>
              </xsl:for-each>
              <xsl:variable name="GroupWellID">
                <xsl:choose>
                  <xsl:when test="msxsl:node-set($countthis)/n">
                    <xsl:value-of select="msxsl:node-set($countthis)/id" />
                  </xsl:when>
                  <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
              <xsl:choose>
                <xsl:when test="$GroupWellID != ''">
                  <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]">
                    <xsl:variable name="conavg">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conavg"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <xsl:variable name="high">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="low">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="bkg">
                      <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                    </xsl:variable>
                    <xsl:variable name="stddev">
                      <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                    </xsl:variable>
                    <xsl:variable name="llod">
                      <xsl:value-of  select="(3 * $stddev) + $bkg" />
                    </xsl:variable>
                    <xsl:variable name="mfiavg">
                      <xsl:value-of  select="@sampleavg" />
                    </xsl:variable>
                    <xsl:variable name="concv">
                      <xsl:value-of  select="@concv * 100" />
                    </xsl:variable>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$mfiavg" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$conavg" />
                      <xsl:with-param name="bkg" select="$bkg" />
                      <xsl:with-param name="high" select="msxsl:node-set($high)/stdconc[1]" />
                      <xsl:with-param name="low" select="msxsl:node-set($low)/stdconc[1]" />
                      <xsl:with-param name="llod" select="$llod" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$concv" />
                    </xsl:call-template>
                  </xsl:for-each>
                  <!--    </xsl:for-each>-->
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(<xsl:value-of select="$n"/>)</Data>
                  </Cell>
                </xsl:when>
                <xsl:otherwise>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                 <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(0)</Data>
                  </Cell>
                </xsl:otherwise>
              </xsl:choose>
            </Row>
          </xsl:for-each>
          <xsl:for-each select="/MasterPlexPlateData/ControlGroupList/ControlGroup">
            <xsl:variable name="countthis">
              <xsl:for-each select="GroupWell">
                <xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
                <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                  <xsl:choose>
                    <xsl:when test="@outlierbs=0">
                      <xsl:element name="n">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="id">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:element name="o">
                        <xsl:value-of select="1" />
                      </xsl:element>
                      <xsl:element name="ido">
                        <xsl:value-of select="$GroupWellID" />
                      </xsl:element>
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:variable>
            <xsl:variable name="n">
              <xsl:value-of select="count(msxsl:node-set($countthis)/n)" />
            </xsl:variable>
            <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              <xsl:for-each select="GroupWell[1]">
              <xsl:variable name="GroupWellID2">
                <xsl:value-of select="@id"/>
              </xsl:variable>
              <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID2]/@name"/>
                </Data>
              </Cell>
              </xsl:for-each>
              <xsl:variable name="GroupWellID">
                <xsl:choose>
                  <xsl:when test="msxsl:node-set($countthis)/n">
                    <xsl:value-of select="msxsl:node-set($countthis)/id" />
                  </xsl:when>
                  <xsl:otherwise></xsl:otherwise>
                </xsl:choose>
              </xsl:variable>
              <xsl:choose>
                <xsl:when test="$GroupWellID != ''">
                  <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]">
                    <xsl:variable name="conavg">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conavg"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>
                    <xsl:variable name="high">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="descending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="low">
                      <xsl:for-each select="../../BeadInfo[@id=$beadid]/StandardCurve/DataSeries/StdWell">
                        <xsl:sort select="@stdconc" data-type="number" order="ascending"/>
                        <xsl:element name="stdconc">
                          <xsl:value-of select="@stdconc"/>
                        </xsl:element>
                      </xsl:for-each>
                    </xsl:variable>
                    <xsl:variable name="bkg">
                      <xsl:value-of select="../../BeadInfo[@id=$beadid]/@bkgvalue" />
                    </xsl:variable>
                    <xsl:variable name="stddev">
                      <xsl:value-of select="../../Well[@type=4]/Bead[@id=$beadid]/@resstddev" />
                    </xsl:variable>
                    <xsl:variable name="llod">
                      <xsl:value-of  select="(3 * $stddev) + $bkg" />
                    </xsl:variable>
                    <xsl:variable name="mfiavg">
                      <xsl:value-of  select="@sampleavg" />
                    </xsl:variable>
                    <xsl:variable name="concv">
                      <xsl:value-of  select="@concv * 100" />
                    </xsl:variable>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$mfiavg" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$conavg" />
                      <xsl:with-param name="bkg" select="$bkg" />
                      <xsl:with-param name="high" select="msxsl:node-set($high)/stdconc[1]" />
                      <xsl:with-param name="low" select="msxsl:node-set($low)/stdconc[1]" />
                      <xsl:with-param name="llod" select="$llod" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="$concv" />
                    </xsl:call-template>
                  </xsl:for-each>
                  <!--    </xsl:for-each>-->
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(<xsl:value-of select="$n"/>)</Data>
                  </Cell>
                </xsl:when>
                <xsl:otherwise>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                 <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">***</Data>
                  </Cell>
                  <Cell ss:StyleID="s84">
                    <Data ss:Type="String">(0)</Data>
                  </Cell>
                </xsl:otherwise>
              </xsl:choose>
            </Row>
          </xsl:for-each>
          
     <Row>
     <Cell ss:Index="2" ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>  
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     </Row>
        
  <!-- Begin Review Section -->
 
  <Row ss:Height="15.75"> 
    
    <Cell ss:Index="2" ss:StyleID="s72"><Data ss:Type="String">Review</Data></Cell>
   </Row>
   <Row ss:Height="13.5"/>
          <Row ss:Height="13.5">
   
    <Cell ss:Index="2" ss:StyleID="s74"><Data ss:Type="String">SampleID</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">Well Location</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">Dilution</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">Run Order</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">MFI</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">Bead Count</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">Concentration</Data></Cell>
    <Cell ss:StyleID="s74"><Data ss:Type="String">%CV</Data></Cell>
   </Row>
      <xsl:for-each select="msxsl:node-set($MasterPlexPlateData)/StandardGroup2">
              <xsl:for-each select="GroupWell">    
              <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              
          		<xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
              <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/> (<xsl:call-template name="Scientific"><xsl:with-param name="Num" select="@stdconc"/></xsl:call-template><xsl:text> </xsl:text><xsl:value-of select="/MasterPlexPlateData/BeadInfo[@id=$beadid]/StandardCurve/@stdunit" />)
                </Data>
              </Cell>  
                
                <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                
                <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="../@addr"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@dilution"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@wellid"/>
                </Data>
              </Cell>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@mfi" />
                    </xsl:call-template>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@count" />
                    </xsl:call-template>   
                  <xsl:variable name="con">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conc"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>  
                 <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$con" />
                    </xsl:call-template> 
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@concv*100" />
                    </xsl:call-template>    
            </xsl:for-each>    
            </Row>
            </xsl:for-each>  
          </xsl:for-each>      
          
          <xsl:for-each select="/MasterPlexPlateData/BkgGroupList/BkgGroup">
             <xsl:for-each select="GroupWell">    
              <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              
          		<xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
               <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
                </Data>
              </Cell> 
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="../@addr"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@dilution"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@wellid"/>
                </Data>
              </Cell>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@mfi" />
                    </xsl:call-template>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@count" />
                    </xsl:call-template>   
                  <xsl:variable name="con">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conc"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>  
                 <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$con" />
                    </xsl:call-template>
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@concv*100" />
                    </xsl:call-template>      
            </xsl:for-each>    
            </Row>
            </xsl:for-each>  
          </xsl:for-each> 
          <xsl:for-each select="/MasterPlexPlateData/UnknowGroupList/UnknowGroup">
             <xsl:for-each select="GroupWell">    
              <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              
          		<xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
                <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
                </Data>
              </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="../@addr"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@dilution"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@wellid"/>
                </Data>
              </Cell>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@mfi" />
                    </xsl:call-template>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@count" />
                    </xsl:call-template>   
                  <xsl:variable name="con">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conc"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>  
                 <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$con" />
                    </xsl:call-template>  
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@concv*100" />
                    </xsl:call-template>    
            </xsl:for-each>    
            </Row>
            </xsl:for-each>  
          </xsl:for-each> 
          <xsl:for-each select="/MasterPlexPlateData/ControlGroupList/ControlGroup">
             <xsl:for-each select="GroupWell">    
              <Row>
              <Cell>
                <Data ss:Type="String"></Data>
              </Cell>
              
          		<xsl:variable name="GroupWellID">
                  <xsl:value-of select="@id"/>
                </xsl:variable>
                <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/@name"/>
                </Data>
              </Cell>
              <xsl:for-each select="/MasterPlexPlateData/Well[@wellid=$GroupWellID]/Bead[@id=$beadid]" >
                <Cell ss:StyleID="s129">
                <Data ss:Type="String">
                  <xsl:value-of select="../@addr"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@dilution"/>
                </Data>
              </Cell>
              <Cell ss:StyleID="s129">
                <Data ss:Type="Number">
                  <xsl:value-of select="../@wellid"/>
                </Data>
              </Cell>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@mfi" />
                    </xsl:call-template>
                <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@count" />
                    </xsl:call-template>   
                  <xsl:variable name="con">
                      <xsl:choose>
                        <xsl:when test="@constr = ''">
                          <xsl:value-of select="@conc"/>
                        </xsl:when>
                        <xsl:otherwise>
                          <xsl:value-of select="@constr"/>
                        </xsl:otherwise>
                      </xsl:choose>
                    </xsl:variable>  
                 <xsl:call-template name="stringtest">
                      <xsl:with-param name="string" select="$con" />
                    </xsl:call-template> 
                    <xsl:call-template name="stringtestb">
                      <xsl:with-param name="string" select="@concv*100" />
                    </xsl:call-template>     
            </xsl:for-each>    
            </Row>
            </xsl:for-each>  
          </xsl:for-each> 
           <Row>
     <Cell ss:Index="2" ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>  
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     <Cell ss:StyleID="s1086"/>
     </Row>      
  <!-- End Review Section -->        
          
        </Table>
        <ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel">
   <Range>R18C4:R<xsl:value-of select="$repnum + 17" />C4</Range>
   <Condition>
    <Qualifier>Less</Qualifier>
    <Value1>R12C[-1]</Value1>
    <Format Style='color:red'/>
   </Condition>
  </ConditionalFormatting>
  <ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel">
   <Range>R18C4:R<xsl:value-of select="$repnum + 17" />C4</Range>
   <Condition>
    <Value1>RC[1]&gt;R13C3</Value1>
    <Format Style='background:yellow'/>
   </Condition>
  </ConditionalFormatting>
  <ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel">
  <Range>R<xsl:value-of select="$repnum + 22" />C8:R<xsl:value-of select="$repnum + 22 + $wellnum" />C8</Range>
    <Condition>
    <Qualifier>Less</Qualifier>
    <Value1>R12C3</Value1>
    <Format Style='color:red'/>
   </Condition>
   <Condition>
    <Qualifier>NotBetween</Qualifier>
    <Value1>R10C3</Value1>
    <Value2>R11C3</Value2>
    <Format Style='font-weight:700'/>
   </Condition>
  </ConditionalFormatting>
  <ConditionalFormatting xmlns="urn:schemas-microsoft-com:office:excel">
   <Range>R<xsl:value-of select="$repnum + 22" />C8:R<xsl:value-of select="$repnum + 22 + $wellnum" />C8</Range>
   <Condition>
    <Value1>RC[1]&gt;R13C3</Value1>
    <Format Style='background:yellow'/>
   </Condition>
  </ConditionalFormatting>
      </xsl:element>
    </xsl:for-each>
  </xsl:for-each>
  <xsl:text disable-output-escaping="yes">&lt;/Workbook&gt;</xsl:text>
  <!--</Workbook>--></xsl:template>
<xsl:template name="Scientific">
  <xsl:param name="Num"/>
  <xsl:if test="boolean(number(substring-after($Num,'E')))">
    <xsl:call-template name="Scientific_Helper">
      <xsl:with-param name="m" select="substring-before($Num,'E')"/>
      <xsl:with-param name="e" select="substring-after($Num,'E')"/>
    </xsl:call-template>
  </xsl:if>
  <xsl:if test="not(boolean(number(substring-after($Num,'E'))))">
    <xsl:value-of select='format-number($Num, "#.00")'/>
  </xsl:if>
</xsl:template>
<xsl:template name="Scientific_Helper">
  <xsl:param name="m"/>
  <xsl:param name="e"/>
  <xsl:choose>
    <xsl:when test="$e = 0 or not(boolean($e))">
      <xsl:value-of select='format-number($m, "#.00")'/>
    </xsl:when>
    <xsl:when test="$e &gt; 0">
      <xsl:call-template name="Scientific_Helper">
        <xsl:with-param name="m" select="$m * 10"/>
        <xsl:with-param name="e" select="$e - 1"/>
      </xsl:call-template>
    </xsl:when>
    <xsl:when test="$e &lt; 0">
      <xsl:call-template name="Scientific_Helper">
        <xsl:with-param name="m" select="$m div 10"/>
        <xsl:with-param name="e" select="$e + 1"/>
      </xsl:call-template>
    </xsl:when>
  </xsl:choose>
</xsl:template>
<xsl:template name="calc_variance">
  <xsl:param name="nodes" />
  <xsl:param name="sum" />
  <xsl:param name="sum-sq" />
  <xsl:param name="count" />
  <xsl:param name="mcparam" />
  <xsl:choose>
    <xsl:when test="not($nodes)">
      <xsl:variable name="variancenum">
        <xsl:value-of select="($sum-sq - ($sum * $sum) div $count) div ($count - 1)"/>
      </xsl:variable>
      <!--<xsl:text>Variance=</xsl:text>
    <xsl:value-of select="$variancenum" />
    <xsl:text>,</xsl:text>-->
    <xsl:call-template name="sqrt">
      <xsl:with-param name="num" select="$variancenum"/>
      <xsl:with-param name="meanconcparam2" select="$mcparam"/>
    </xsl:call-template>
  </xsl:when>
  <xsl:otherwise>
    <xsl:variable name="value" select="$nodes[1]"/>
    <xsl:call-template name="calc_variance">
      <xsl:with-param name="nodes" select="$nodes[position( ) != 1]"/>
      <xsl:with-param name="sum" select="$sum + $value"/>
      <xsl:with-param name="sum-sq" select="$sum-sq + ($value * $value)"/>
      <xsl:with-param name="count" select="$count + 1"/>
      <xsl:with-param name="mcparam" select="$mcparam"/>
    </xsl:call-template>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="stringtest">
<xsl:param name="string"/>
<xsl:param name="low"/>
<xsl:param name="high"/>
<xsl:param name="llod"/>
<xsl:choose>
  <xsl:when test="starts-with($string, 'NaN')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">***</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, 'Error')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">Error</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, 'Infinity')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">Infinity</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, '-Infinity')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">Infinity</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, '&lt;')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">&lt;OOR</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, '&gt;')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">&gt;OOR</Data>
    </Cell>
  </xsl:when>
  <xsl:otherwise>
    <xsl:choose>
      <xsl:when test="$string &gt; $high ">
        <Cell ss:StyleID="s86">
          <Data ss:Type="Number">
            <xsl:call-template name="Scientific">
              <xsl:with-param name="Num" select="$string" />
            </xsl:call-template>
          </Data>
        </Cell>
      </xsl:when>
      <xsl:when test="$string &lt; $low ">
        <Cell ss:StyleID="s86">
          <Data ss:Type="Number">
            <xsl:call-template name="Scientific">
              <xsl:with-param name="Num" select="$string" />
            </xsl:call-template>
          </Data>
        </Cell>
      </xsl:when>
      <xsl:otherwise>
        <xsl:choose>
          <xsl:when test="$string &lt; $llod ">
            <Cell ss:StyleID="s93">
              <Data ss:Type="Number">
                <xsl:call-template name="Scientific">
                  <xsl:with-param name="Num" select="$string" />
                </xsl:call-template>
              </Data>
            </Cell>
          </xsl:when>
          <xsl:otherwise>
            <Cell ss:StyleID="s84">
              <Data ss:Type="Number">
                <xsl:call-template name="Scientific">
                  <xsl:with-param name="Num" select="$string" />
                </xsl:call-template>
              </Data>
            </Cell>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="stringtestb">
<xsl:param name="string"/>
<xsl:choose>
  <xsl:when test="starts-with($string, 'NaN')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">***</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, 'Error')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">Error</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, 'Infinity')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">Infinity</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, '-Infinity')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">Infinity</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, '&lt;')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">&lt;OOR</Data>
    </Cell>
  </xsl:when>
  <xsl:when test="starts-with($string, '&gt;')">
    <Cell ss:StyleID="s84">
      <Data ss:Type="String">&gt;OOR</Data>
    </Cell>
  </xsl:when>
  <xsl:otherwise>
    <Cell ss:StyleID="s84">
      <Data ss:Type="Number">
        <xsl:call-template name="Scientific">
          <xsl:with-param name="Num" select="$string" />
        </xsl:call-template>
      </Data>
    </Cell>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="sqrt">
<xsl:param name="num" select="0"/>
<!-- The number you want to find the square root of -->
<xsl:param name="try" select="1"/>
<!-- The current 'try'.  This is used  internally. -->
<xsl:param name="iter" select="1"/>
<!-- The current iteration, checked against maxiter to limit loop count -->
<xsl:param name="maxiter" select="10"/>
<!-- Set this up to insure  against infinite loops -->
<!-- This template was written by Nate Austin using Sir Isaac Newton's  method of finding roots -->
<xsl:choose>
  <xsl:when test="$try * $try = $num or $iter &gt; $maxiter">
    <xsl:value-of select="$try"/>
  </xsl:when>
  <xsl:otherwise>
    <xsl:call-template name="sqrt">
      <xsl:with-param name="num" select="$num"/>
      <xsl:with-param name="try" select="$try - (($try * $try - $num) div (2 * $try))"/>
      <xsl:with-param name="iter" select="$iter + 1"/>
      <xsl:with-param name="maxiter" select="$maxiter"/>
    </xsl:call-template>
  </xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<!-- Hitachi Software Engineering America, Ltd -->
<!-- MiraiBio Group  (date) 10.3.2008          -->
