<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<!-- Author: Hector Tello - AEM Corporation 
	     Version: 4.0 
		 Created: October 2007
	-->

	<xsl:include href="pbdmi-common-4.xsl"/>

	<xsl:output indent="yes"/>

	<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" STATESCHOOLIDNUMBER="001000-00001">-->
				<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:if test="StateLeaIdNumber">
						<xsl:attribute name="STATELEAIDNUMBER">
							<xsl:value-of select="StateLeaIdNumber"/>
						</xsl:attribute>
					</xsl:if>

					<xsl:if test="StateSchoolIdNumber">
						<xsl:attribute name="STATESCHOOLIDNUMBER">
							<xsl:value-of select="StateSchoolIdNumber"/>
						</xsl:attribute>
					</xsl:if>

					<!--loop through LEP child elements-->
					<xsl:for-each select="LepEligible">
						<!--<TABLETYPE TYPEABBRV="LEP" TOTALINDICATOR="N">-->
						<xsl:element name="TABLETYPE">
							<xsl:attribute name="TYPEABBRV">LEPELIG</xsl:attribute>
							<xsl:attribute name="TOTALINDICATOR">
								<xsl:value-of select="TotalIndicator"/>
							</xsl:attribute>

							<!--<CATEGORY TYPE="GRADELVBASIC" VALUE="KG"/>-->
							<xsl:apply-templates select="GradeLevelBasic">
								<xsl:with-param name="value">
									<xsl:value-of select="GradeLevelBasic"/>
								</xsl:with-param>
							</xsl:apply-templates>

							<!--<CATEGORY TYPE="RACEETHNIC" VALUE="AS"/>-->
							<xsl:apply-templates select="RaceEthnic">
								<xsl:with-param name="value">
									<xsl:value-of select="RaceEthnic"/>
								</xsl:with-param>
							</xsl:apply-templates>

							<!--<CATEGORY TYPE="SEX" VALUE="M"/>-->
							<xsl:apply-templates select="Sex">
								<xsl:with-param name="value">
									<xsl:value-of select="Sex"/>
								</xsl:with-param>
							</xsl:apply-templates>

							<!--<CATEGORY TYPE="DISABSTATUS" VALUE="DIS"/>-->
							<xsl:apply-templates select="DisabilityStatusOnly">
								<xsl:with-param name="value">
									<xsl:value-of select="DisabilityStatusOnly"/>
								</xsl:with-param>
							</xsl:apply-templates>

							<!--<AMOUNT>500</AMOUNT>-->
							<xsl:apply-templates select="Amount">
								<xsl:with-param name="value">
									<xsl:value-of select="Amount"/>
								</xsl:with-param>
							</xsl:apply-templates>

							<!--<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:for-each>
		</xsl:element>
	</xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="no" name="School" userelativepaths="yes" externalpreview="no" url="TestFiles\x047_school.xml" htmlbaseurl="" outputurl="TestFiles\transformed\x047_school.xml" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="yes" validator="internal" customvalidator="" ><validatorSchema value="..\LegacyXSD\SchoolMetric.xsd"/></scenario><scenario default="no" name="LEA" userelativepaths="yes" externalpreview="no" url="TestFiles\x047_lea.xml" htmlbaseurl="" outputurl="TestFiles\transformed\x047_lea.xml" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="yes" validator="internal" customvalidator="" ><validatorSchema value="..\LegacyXSD\LocalEducationAgencyMetric.xsd"/></scenario><scenario default="yes" name="SEA" userelativepaths="yes" externalpreview="no" url="TestFiles\x047_sea.xml" htmlbaseurl="" outputurl="TestFiles\transformed\x047_sea.xml" processortype="internal" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="yes" validator="internal" customvalidator="" ><validatorSchema value="..\LegacyXSD\StateAgencyMetric.xsd"/></scenario></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no" ><SourceSchema srcSchemaPath="TestFiles\x047_sea.xml" srcSchemaRoot="SeaLepEligible" AssociatedInstance="" loaderFunction="document" loaderFunctionUsesURI="no"/></MapperInfo><MapperBlockPosition><template match="*"><block path="xsl:element/xsl:attribute/xsl:value&#x2D;of" x="359" y="36"/><block path="xsl:element/xsl:attribute[1]/xsl:value&#x2D;of" x="399" y="54"/><block path="xsl:element/xsl:attribute[2]/xsl:value&#x2D;of" x="359" y="72"/><block path="xsl:element/xsl:for&#x2D;each" x="399" y="90"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:attribute/xsl:value&#x2D;of" x="359" y="108"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:attribute[1]/xsl:value&#x2D;of" x="399" y="126"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:if" x="319" y="144"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:if/xsl:attribute/xsl:value&#x2D;of" x="359" y="144"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:if[1]" x="279" y="162"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:if[1]/xsl:attribute/xsl:value&#x2D;of" x="399" y="162"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each" x="39" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:attribute[1]/xsl:value&#x2D;of" x="359" y="216"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates" x="359" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[1]" x="319" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[2]" x="279" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[3]" x="239" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[4]" x="199" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[5]" x="159" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[6]" x="119" y="180"/><block path="xsl:element/xsl:for&#x2D;each/xsl:element/xsl:for&#x2D;each/xsl:element/xsl:apply&#x2D;templates[7]" x="79" y="180"/></template></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->