<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<!-- Author: Hector Tello - AEM Corporation -->
	<!-- Version: 7.1 -->
	<!-- Created: April 2011 -->
	<!-- Modified: April 2011 -->
	
	<xsl:include href="pbdmi-common-7.xsl"/>

	<xsl:output indent="yes" method="xml"/>

	<xsl:template match="*">

		<!-- HEADER -->
		<xsl:element name="FILETRANSMISSION">
			<xsl:attribute name="FILELAYOUTTYPE">
				<xsl:value-of select="FileLayoutType"/>
			</xsl:attribute>
			<xsl:attribute name="FILEID">
				<xsl:value-of select="FileId"/>
			</xsl:attribute>
			<xsl:attribute name="SCHOOLYEAR">
				<xsl:value-of select="SchoolYear"/>
			</xsl:attribute>

			<xsl:variable name="fips" select="FipsStateCode"/>

			<!--loop through agency elements-->
			<xsl:for-each select="Agency">
				<!--<AGENCY FIPSSTATECODE="01" STATEAGENCYIDNUMBER="01" STATELEAIDNUMBER="001000-0000001">-->
				<xsl:element name="AGENCY">
					<xsl:attribute name="FIPSSTATECODE">
						<xsl:value-of select="$fips"/>
					</xsl:attribute>

					<xsl:attribute name="STATEAGENCYIDNUMBER">
						<xsl:value-of select="StateAgencyIdNumber"/>
					</xsl:attribute>

					<xsl:attribute name="STATELEAIDNUMBER">
						<xsl:value-of select="StateLeaIdNumber"/>
					</xsl:attribute>

					<xsl:attribute name="STATESCHOOLIDNUMBER">
						<xsl:value-of select="StateSchoolIdNumber"/>
					</xsl:attribute>

					<!-- ID 31 - School Poverty Percentage -->
					<xsl:if test="SchoolPovertyPercentage">
						<xsl:element name="POVERTYPERCENT">
							<xsl:value-of select="SchoolPovertyPercentage"/>
						</xsl:element>
					</xsl:if>

					<!-- DG 56 - Economically Disadvantaged Students-->
					<xsl:if test="EconomicallyDisadvantagedCount">
						<xsl:element name="ECOCIRCUM">
							<xsl:value-of select="EconomicallyDisadvantagedCount"/>
						</xsl:element>
					</xsl:if>					

					<!-- DG 693 - School Improvement Funds Status-->
					<xsl:if test="ImprovementFundsStatus">
						<xsl:element name="IMPFUNDSTAT">
							<xsl:value-of select="ImprovementFundsStatus"/>
						</xsl:element>
					</xsl:if>

					<!-- ID 694(a) - School Improvement Funds Allocation – 1003(a) -->
					<xsl:if test="ImprovementFundsAllocationA">
						<xsl:element name="IMPFUNDALLOCA">
							<xsl:value-of select="ImprovementFundsAllocationA"/>
						</xsl:element>
					</xsl:if>

					<!-- ID 694(g) - School Improvement Funds Allocation – 1003(g) -->
					<xsl:if test="ImprovementFundsAllocationG">
						<xsl:element name="IMPFUNDALLOCG">
							<xsl:value-of select="ImprovementFundsAllocationG"/>
						</xsl:element>
					</xsl:if>

					<!--<EXPLANATION></EXPLANATION>-->
					<xsl:apply-templates select="Explanation">
						<xsl:with-param name="value">
							<xsl:value-of select="Explanation"/>
						</xsl:with-param>
					</xsl:apply-templates>
				</xsl:element>
			</xsl:for-each>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2009. Progress Software Corporation. All rights reserved.

<metaInformation>
	<scenarios/>
	<MapperMetaTag>
		<MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/>
		<MapperBlockPosition></MapperBlockPosition>
		<TemplateContext></TemplateContext>
		<MapperFilter side="source"></MapperFilter>
	</MapperMetaTag>
</metaInformation>
-->