<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<!-- Created: April 2012 -->
	<!-- Version: 8.0 -->
	<xsl:include href="pbdmi-common-8.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" STATESCHOOLIDNUMBER="001000-001">--><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 TEACH child elements-->
					<xsl:for-each select="TeacherEvaluation">
						<!--<TABLETYPE TYPEABBRV="TEACH" TOTALINDICATOR="N">-->
							<xsl:element name="TABLETYPE">
								<xsl:attribute name="TYPEABBRV">TEACH</xsl:attribute>
								<xsl:attribute name="TOTALINDICATOR">
								<xsl:value-of select="TotalIndicator"/>
							</xsl:attribute>
							<!--<CATEGORY TYPE="FACADMPERFLVL" VALUE="FAL1"/>-->
							<xsl:apply-templates select="FacultyAdminPerformanceLevel">
								<xsl:with-param name="value">
									<xsl:value-of select="FacultyAdminPerformanceLevel"/>
								</xsl:with-param>
							</xsl:apply-templates>
							<!-- DG 747 - Teacher Performace Level Name -->
							<xsl:if test="TeacherPerformanceLevelName">
								<xsl:element name="PERFLVLNAME">
									<xsl:value-of select="TeacherPerformanceLevelName"/>
								</xsl:element>
							</xsl:if>
							<!--<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>
					<!--loop through PRINCIP child elements-->
					<xsl:for-each select="PrincipalEvaluation">
						<!--<TABLETYPE TYPEABBRV="PRINCIP" TOTALINDICATOR="N">-->
						<xsl:element name="TABLETYPE">
							<xsl:attribute name="TYPEABBRV">PRINCIP</xsl:attribute>
							<xsl:attribute name="TOTALINDICATOR">
								<xsl:value-of select="TotalIndicator"/>
							</xsl:attribute>
							<!--<CATEGORY TYPE="FACADMPERFLVL" VALUE="FAL1"/>-->
							<xsl:apply-templates select="FacultyAdminPerformanceLevel">
								<xsl:with-param name="value">
									<xsl:value-of select="FacultyAdminPerformanceLevel"/>
								</xsl:with-param>
							</xsl:apply-templates>
							<!-- DG 748 - Principal Performace Level Name -->
							<xsl:if test="PrincipalPerformanceLevelName">
								<xsl:element name="PERFLVLNAME">
									<xsl:value-of select="PrincipalPerformanceLevelName"/>
								</xsl:element>
							</xsl:if>
							<!--<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>