<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:rs="urn:schemas-microsoft-com:rowset" 
xmlns:z="#RowsetSchema">
<xsl:template match="rs:data">

<xsl:param name="fullyadressed" select="z:row[@ows_ICAO_x0020_CAP_x0020_Comments='Fully addresses']"/>
<xsl:param name="notfullyadressed" select="z:row[@ows_ICAO_x0020_CAP_x0020_Comments!='Fully addresses']"/>
<xsl:param name="notdone" select="z:row[@ows_Status!='Completed' and @ows_Status!='75%' and @ows_Status!='50%']"/>
<xsl:param name="faandcomp" select="$fullyadressed[not(@ows_Title=$notdone/@ows_Title)]"/>
<xsl:param name="faandnotcomp" select="$fullyadressed[@ows_Title=$notdone/@ows_Title]"/>
<xsl:param name="statelist" select="z:row[not(@ows_State_ABR = preceding-sibling::z:row/@ows_State_ABR)]"/>


<chart plotFillRatio='0' showlabels='1' rotateLabels='1' showlegend='0'
  showValues='0'  showYAxisValues='0' bgcolor='FFFFFF' showSum='1' showBorder='0'
  seriesNameInToolTip='1' caption='CAP Summaries'>


<categories>

<xsl:for-each select="$statelist">
<category>
	<xsl:attribute name="label">
		<xsl:value-of select="substring-after(@ows_State_ABR,'#')"/>
	</xsl:attribute>
</category>
</xsl:for-each>
</categories>

<dataset seriesName='Fully adressed and completed' color="00FF00">
<xsl:for-each select="$statelist">

	<set>
	<xsl:attribute name="value">
	<xsl:value-of select="count($faandcomp[@ows_State_ABR=current()/@ows_State_ABR])"/>
	</xsl:attribute>
	</set>	
</xsl:for-each>
</dataset>

<dataset seriesName='Fully adressed but not completed' color="00FF00" alpha='50'>
<xsl:for-each select="$statelist">

	<set>
	<xsl:attribute name="value">
	<xsl:value-of select="count($faandnotcomp[@ows_State_ABR=current()/@ows_State_ABR])"/>
	</xsl:attribute>
	</set>	
</xsl:for-each>
</dataset>

<dataset seriesName='Not fully adressed' color="FF0000" alpha='50'>
<xsl:for-each select="$statelist">

	<set>
	<xsl:attribute name="value">
	<xsl:value-of select="count($notfullyadressed[@ows_State_ABR=current()/@ows_State_ABR])"/>
	</xsl:attribute>
	</set>	
</xsl:for-each>
</dataset>

</chart>
</xsl:template>

</xsl:stylesheet>