<?xml version="1.0"?>
<!-- Author : R.Vijayavel, Mastek  -->
<!-- Prepared for  PLASC07-Nursery School Summary Report-HTML Presentation  on 2006-07-12-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:data="Mastek1" >


<xsl:output method="html"/>

<xsl:key name="kClassName" match="//SchoolSurvey/Classes/Class/Name" use="."/>

<xsl:param name = "lang" />			<!-- denotes language -->
<xsl:param name = "dateTime" /> 	<!-- denotes Date and Time in DD-MM-YYYY#hh:mm format -->
<xsl:param name = "errors" />    	<!-- denotes number of errors and number of warnings in "errors/warnings" format -->

<xsl:template match="/">
	<xsl:apply-templates select="SchoolSurvey"/>
	<html>
		<head>
			<title>PLASC07-NURSERY SCHOOL SUMMARY</title>			
		</head>
		
		<body>
		<br/>
		<h3>Pupil Level Annual Census - January 2007</h3>
			<table border="0">
				<tr>			
					<xsl:if test = "$lang='Welsh'"><td><b><u>Crynodeb ar gyfer </u></b></td></xsl:if>
					<xsl:if test = "$lang='English'"><td><b><u>Summary for  </u></b></td>	</xsl:if>
					<td><b><xsl:value-of select="Message/School/Name" /></b></td>
				</tr>
			</table><br/>
			<table border="0">
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Cod AALl</td></xsl:if>
					<xsl:if test = "$lang='English'"><td>LEA code</td>	</xsl:if>
					<td>: <xsl:value-of select="Message/School/LEA"/></td>				
				</tr>
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Rhif ysgol</td></xsl:if>
					<xsl:if test = "$lang='English'">	<td>NAW school number</td></xsl:if>
					<td>: <xsl:value-of select="Message/School/Estab" /></td>				
				</tr>
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Rhif ffôn</td></xsl:if>
					<xsl:if test = "$lang='English'"><td>Telephone number</td>	</xsl:if>
					<td>: <xsl:value-of select="Message/School/PhoneNo" /></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Rhif ffacs</td></xsl:if>
					<xsl:if test = "$lang='English'"><td>Fax number</td>	</xsl:if>
					<td>: <xsl:value-of select="Message/School/FaxNo" /></td>
				</tr>		
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Cyfeiriad e-bost</td></xsl:if>
					<xsl:if test = "$lang='English'"><td>E-mail address</td>	</xsl:if>
					<td>: <xsl:value-of select="Message/School/Email" /></td>
				</tr>		
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Cyfeiriad rhyngrwyd</td></xsl:if>
					<xsl:if test = "$lang='English'"><td>Internet address</td>	</xsl:if>
					<td>: <xsl:value-of select="Message/School/InternetAddress" /></td>
				</tr>						
				<tr>
					<xsl:if test = "$lang='Welsh'"><td>Ysgol Bechgyn/Merched/Cymysg</td></xsl:if>
					<xsl:if test = "$lang='English'"><td>Boys,Girls or Mixed School</td>	</xsl:if>
					<td>: <xsl:value-of select="Message/School/GenderMix" /></td>
				</tr>															
			</table>  
			<br/><br/>			
			
			<xsl:if test = "$lang='English'"><b><u>1.1 Pupils' registered on roll: by gender,age and mode of attendance </u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u>1.1 Disgyblion ar y gofrestr: yn ôl rhyw, oedran a blwyddyn ysgol </u></b></xsl:if>
			<br/><br/>
			<table border="1" cellpadding="7" cellspacing="0">
			<xsl:if test = "$lang='English'">
				<tr>			
					<th rowspan="2">Age</th>
					<th rowspan="2">Date of Birth</th>
					<th colspan="2" width="20%">Full-time</th>  								
					<th colspan="2" width="20%">Part-time</th>  								
  				</tr>
  			</xsl:if>
  			
  			<xsl:if test = "$lang='Welsh'">
				<tr>
					<th rowspan="2">Oedran</th>
					<th rowspan="2">Dyddiad Geni</th>
					<th colspan="2" width="25%">Amser llawn</th>  								
					<th colspan="2" width="25%">Rhan amser</th> 
	 					
  				</tr>  				
  			</xsl:if>
  			<tr>
  				<xsl:if test = "$lang='English'"><th>Boys</th><th>Girls</th><th>Boys</th><th>Girls</th></xsl:if>
  				<xsl:if test = "$lang='Welsh'"><th>Bechgyn</th> <th>Merched</th> <th>Bechgyn</th> <th>Merched</th></xsl:if>
  			</tr>			
			
			<tr>
				<xsl:if test = "$lang='English'">
					<td> 5 and over</td><td>31/8/01 and earlier </td>
				</xsl:if>
				<xsl:if test = "$lang='Welsh'">
					<td>5 neu'n hŷn</td><td>31/8/01 a chynt </td>					
				</xsl:if>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
			</tr>			
			<tr>
				<xsl:if test = "$lang='English'"><td>4.8 (mths)</td></xsl:if>
				<xsl:if test = "$lang='Welsh'"><td>4.8 (mis)</td></xsl:if>
				<td>1/9/01  - 31/12/01 </td>	
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20010901 and translate(DOB,'-','') &lt;= 20011231) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20010901 and translate(DOB,'-','') &lt;= 20011231) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20010901 and translate(DOB,'-','') &lt;= 20011231) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20010901 and translate(DOB,'-','') &lt;= 20011231) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			<tr>
				<xsl:if test = "$lang='English'"><td>4.5 (mths)</td></xsl:if>
				<xsl:if test = "$lang='Welsh'"><td>4.5 (mis)</td></xsl:if>
				<td>1/1/02 - 31/3/02 </td>	
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020101 and translate(DOB,'-','') &lt;= 20020331) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020101 and translate(DOB,'-','') &lt;= 20020331) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020101 and translate(DOB,'-','') &lt;= 20020331) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020101 and translate(DOB,'-','') &lt;= 20020331) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			<tr>
				<td>4</td><td>1/4/02  - 31/8/02 </td>	
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020401 and translate(DOB,'-','') &lt;= 20020831) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020401 and translate(DOB,'-','') &lt;= 20020831) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020401 and translate(DOB,'-','') &lt;= 20020831) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020401 and translate(DOB,'-','') &lt;= 20020831) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			<tr>
				<xsl:if test = "$lang='English'"><td>3.8 (mths)</td></xsl:if>
				<xsl:if test = "$lang='Welsh'"><td>3.8 (mis)</td></xsl:if>
				<td>1/9/02  - 31/12/02 </td>	
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020901 and translate(DOB,'-','') &lt;= 20021231) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020901 and translate(DOB,'-','') &lt;= 20021231) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020901 and translate(DOB,'-','') &lt;= 20021231) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20020901 and translate(DOB,'-','') &lt;= 20021231) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			<tr>
				<xsl:if test = "$lang='English'"><td>3.5 (mths)</td></xsl:if>
				<xsl:if test = "$lang='Welsh'"><td>3.5 (mis)</td></xsl:if>
				<td>1/1/03 - 31/3/03 </td>	
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030101 and translate(DOB,'-','') &lt;= 20030331) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030101 and translate(DOB,'-','') &lt;= 20030331) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030101 and translate(DOB,'-','') &lt;= 20030331) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030101 and translate(DOB,'-','') &lt;= 20030331) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			<tr>
				<td>3</td><td>1/4/03  - 31/8/03 </td>	
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030401 and translate(DOB,'-','') &lt;= 20030831) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030401 and translate(DOB,'-','') &lt;= 20030831) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030401 and translate(DOB,'-','') &lt;= 20030831) and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(translate(DOB,'-','') &gt;= 20030401 and translate(DOB,'-','') &lt;= 20030831) and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			
			<tr>
				<xsl:if test = "$lang='English'"><td>2 or under</td><td>1/9/03 or later</td></xsl:if>
				<xsl:if test = "$lang='Welsh'"><td>2 neu lai</td><td>1/9/03 neu'n ddiweddarach</td></xsl:if>				
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt;= 2 and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt;= 2 and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt;= 2 and Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>
				<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt;= 2 and Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></td>		
			</tr>
			<tr>
				<xsl:if test = "$lang='English'"><td colspan="2"><b> All ages</b></td></xsl:if>
				<xsl:if test = "$lang='Welsh'"><td colspan="2"><b> Pob oedran</b></td></xsl:if>
				<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></b></td>
				<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='FALSE' or PartTime=0)] )" /></b></td>
				<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></b></td>
				<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and (translate(normalize-space(PartTime),$vLower,$vUpper)='TRUE' or PartTime=1)] )" /></b></td>
			</tr>			
			</table>
			<br/><br/>
			
			<table>
				<tr>
					<td><xsl:if test = "$lang='English'">Total number of full-time pupils present on Census day</xsl:if>					
					<xsl:if test = "$lang='Welsh'">Nifer y disgyblion llawn-amser a oedd yn bresennol yn yr ysgol ar ddyddiad y cyfrifiad</xsl:if></td>
					<td> = <xsl:value-of select="//SchoolSurvey/FullTimeAttendanceCensusDay"/></td>
				</tr>
				<tr>
					<td><xsl:if test = "$lang='English'">Total number of part-time pupils present on Census day</xsl:if>					
					<xsl:if test = "$lang='Welsh'">Nifer y disgyblion rhan-amser a oedd yn bresennol yn yr ysgol ar ddyddiad y cyfrifiad</xsl:if></td>
					<td> = <xsl:value-of select="//SchoolSurvey/PartTimeAttendanceCensusDay"/></td>
				</tr>
			</table>
						
			<P CLASS="breakhere">
			<xsl:if test = "$lang='English'"><b><u>1.2 Mode of attendance of part-time children</u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u> 1.2 Modd presenoldeb plant rhan-amser</u></b></xsl:if>
			<br/><br/>
			<table border="1" cellpadding="7"  cellspacing="0">
				<tr>
					<xsl:if test = "$lang='English'"><th>Attendance</th><th>Number of part-time pupils</th></xsl:if>
					<xsl:if test = "$lang='Welsh'"><th>Presenoldeb</th><th>Nifer y disgyblion rhan-amser</th></xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>In morning only</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Bore yn unig</td></xsl:if>
					<td><xsl:value-of select="//SchoolSurvey/MorningAttendance"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>In afternoons only</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Prynhawn yn unig</td></xsl:if>
					<td><xsl:value-of select="//SchoolSurvey/AfternoonAttendance"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Other arrangements</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Trefniadau eraill</td></xsl:if>
					<td><xsl:value-of select="//SchoolSurvey/OtherAttendance"/></td>					
				</tr>				
			</table>
			<br/><br/>
			
				<xsl:if test="$lang='English'"><u><b>1.3 Registered classes</b></u></xsl:if>
				<xsl:if test="$lang='Welsh'"><u><b>1.3 Dosbarthiadau cofrestredig</b></u></xsl:if>
				<br/><br/>
				
				<table border="1" cellpadding="7"  cellspacing="0" width="60%">
					<tr>
						<xsl:if test="$lang='English'">
							<th>Class</th><th>Class Reference number</th><th>Number of pupils in class</th>
							<th>of which: number with statement of SEN</th>
						</xsl:if>
						<xsl:if test="$lang='Welsh'">
							<th>Dosbarth</th><th>Rhif cyfeirnod y dosbarth </th><th>Nifer y disgyblion</th>
							<th>o&apos;r rheini: nifer a gatganiad o AAA </th>
						</xsl:if>						
					</tr>
					<xsl:for-each select = "//SchoolSurvey/Classes/Class/Name">					
						<xsl:sort order = "ascending" />
						<xsl:if test="generate-id(.) = generate-id(key('kClassName', .)[1])">
						<xsl:variable name="Name" select="."/>
						<tr>
							<td><xsl:value-of select="position()" /></td>
							<td><xsl:value-of select="$Name"/></td>
							<td><xsl:value-of select="sum(../HomePupils[../Name=$Name])"/></td>
							<td><xsl:value-of select="sum(../SENPupilsInClass[../Name=$Name])"/></td>
						</tr>
					</xsl:if>	
				</xsl:for-each>							
				</table>
				<br/><br/>				
			</P>
			
			<P CLASS="breakhere">
			<xsl:if test = "$lang='English'"><b><u>2.1 Teaching staff</u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u>2.1 Staff addysgu</u></b></xsl:if>				 
			<br/><br/>
			<table border="1" cellpadding="5"  cellspacing="0" width="80%">
				<tr>
					<xsl:if test = "$lang='English'">
						<th rowspan="2" width="40%"></th><th colspan="2">Full-time staff</th><th colspan="4">Part time staff</th>
					</xsl:if>
					<xsl:if test = "$lang='Welsh'">
						<th rowspan="2" width="50%"></th><th colspan="2">Staff amser-llawn</th><th colspan="4">Staff rhan-amser</th>
					</xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'">
						<th>Men</th><th>Women</th>
						<th>Men</th><th width="10%">Total directed hours per week</th><th>Women</th><th width="10%">Total directed hours per week</th>
					</xsl:if>
					<xsl:if test = "$lang='Welsh'">
						<th>Dynion</th><th>Menywod</th>
						<th>Dynion</th><th width="7%">Cyfanswm oriau o dan gyfarwyddyd</th><th>Menywod</th><th width="7%">Cyfanswm oriau o dan gyfarwyddyd</th>
					</xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Head or acting head teacher</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Pennaeth neu bennaeth gweithredol</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='HT' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='HT' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='HT' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='HT' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='HT' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='HT' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Deputy head</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Dirprwy bennaeth</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='DH' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='DH' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='DH' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='DH' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='DH' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='DH' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Other qualified teachers</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Athrawon cymwysedig eraill</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='QT' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='QT' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='QT' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='QT' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='QT' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='QT' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Number of unqualified (e.g. students) teachers or instructors</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Nifer yr athrawon neu hyfforddwyr anghymwysedig (ee myfyrwyr)</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='NQ' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='NQ' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='NQ' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='NQ' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='NQ' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='NQ' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Peripatetic teachers in school on the enumeration date</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Athrawon peripatetig yn yr ysgol ar ddyddiad y cyfrif</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PT' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PT' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PT' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='PT' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PT' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='PT' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>				
				<tr>
					<xsl:if test = "$lang='English'"><td>Permanent supply teachers based in school, not already entered above</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Athrawon cyflenwi parhaol yn seiliedig yn yr ysgol,sydd heb eu nodi uchod eisioes</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PS' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PS' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PS' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='PS' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[../TeacherCategory='PS' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[../TeacherCategory='PS' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>	
				<tr>
					<xsl:if test = "$lang='English'"><td><b>Total</b></td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td><b>Cyfanswm</b></td></xsl:if>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[(contains($TeacherCategory,concat(' ',../TeacherCategory,' '))) and ../Gender='M' and ../Tenure='F'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[(contains($TeacherCategory,concat(' ',../TeacherCategory,' '))) and ../Gender='F' and ../Tenure='F'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[(contains($TeacherCategory,concat(' ',../TeacherCategory,' '))) and ../Gender='M' and ../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[(contains($TeacherCategory,concat(' ',../TeacherCategory,' '))) and ../Gender='M' and ../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/Headcount[(contains($TeacherCategory,concat(' ',../TeacherCategory,' '))) and ../Gender='F' and ../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/PartTimeHours[(contains($TeacherCategory,concat(' ',../TeacherCategory,' '))) and ../Gender='F' and ../Tenure='P'])"/></b></td>
				</tr>
			</table>
			<br/><br/>
			</P> 
			
			<P CLASS="breakhere">
			<xsl:if test = "$lang='English'"><b><u>2.2 Qualified teachers on contracts of one year or less</u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u>2.2 Athrawon cymwysedig sydd ar gontractau o un flwyddyn neu lai</u></b></xsl:if>				 
			<br/><br/>
			<table border="1" cellpadding="7"  cellspacing="0">
				<tr>
					<xsl:if test = "$lang='English'">
						<th rowspan="2" width="25%"></th><th rowspan="2">Number of full-time teachers</th><th colspan="2">Part-time teachers</th>
					</xsl:if>
					<xsl:if test = "$lang='Welsh'">
						<th rowspan="2" width="30%"></th><th rowspan="2">Nifer yr athrawon llawn-amser</th><th colspan="2">Athrawon rhan-amser</th>
					</xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'">
						<th>Number of teachers</th><th>Hours per week</th>
					</xsl:if>
					<xsl:if test = "$lang='Welsh'">
						<th>Nifer yr athrawon</th><th>Oriau yr wythnos</th>
					</xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Men</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Dynion</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContracts[../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContracts[../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContractsPartTimeHours[../Gender='M' and ../Tenure='P'])"/></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Women</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Menywod</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContracts[../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContracts[../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContractsPartTimeHours[../Gender='F' and ../Tenure='P'])"/></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Total</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Cyfanswm</td></xsl:if>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContracts[../Tenure='F'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContracts[../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/Teachers/CategoryDetails/TeacherContractsPartTimeHours[../Tenure='P'])"/></b></td>
				</tr>				
			</table>
			<br/><br/>				
			
			<xsl:if test = "$lang='English'"><b><u>2.3 Nursery assistants</u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u>2.3 Cynorthwywyr meithrin</u></b></xsl:if>				 
			<br/><br/>
			<table border="1" cellpadding="5"  cellspacing="0" width="80%">
				<tr>
					<xsl:if test = "$lang='English'">
						<th rowspan="2" width="40%"></th><th colspan="2">Full-time staff</th><th colspan="4">Part time staff</th>
					</xsl:if>
					<xsl:if test = "$lang='Welsh'">
						<th rowspan="2" width="40%"></th><th colspan="2">Staff amser-llawn</th><th colspan="4">Staff rhan-amser</th>
					</xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'">
						<th>Men</th><th>Women</th>
						<th>Men</th><th width="10%">Total directed hours per week</th><th>Women</th><th width="10%">Total directed hours per week</th>
					</xsl:if>
					<xsl:if test = "$lang='Welsh'">
						<th>Dynion</th><th>Menywod</th>
						<th>Dynion</th><th width="10%">Cyfanswm oriau o dan gyfarwyddyd</th><th>Menywod</th><th width="10%">Cyfanswm oriau o dan gyfarwyddyd</th>
					</xsl:if>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>NNEB or CACHE (Class 1)</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>NNEB neu CACHE (Dosbarth 1)</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N1' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N1' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N1' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='N1' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N1' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='N1' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Other assistants (Class 2)</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Cynrthwywyr eraill (Dosbarth 2)</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N2' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N2' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N2' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='N2' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='N2' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='N2' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td colspan="7">CACHE students in training :</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td colspan="7">Myfyrwyr Cache dan hyfforddiant :</td></xsl:if>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Year 1 of 2 year course</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Blwyddyn 1 o gwrs dwy flynedd</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S1' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S1' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S1' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='S1' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S1' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='S1' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Year 2 of 2 year course</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Blwyddyn 2 o gwrs dwy flynedd</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S2' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S2' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S2' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='S2' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S2' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='S2' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>On 1 year course</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Ar gwrs blwyddyn</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S3' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S3' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S3' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='S3' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='S3' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='S3' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Permanent supply nuesery assistants based in school, not already entered above</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Cynorthwywyr Meithrin Cyflewni Parhaol yn seiliedig yn yr ysgol sydd heb eu nodi uchod</td></xsl:if>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='PN' and ../Gender='M' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='PN' and ../Gender='F' and ../Tenure='F'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='PN' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='PN' and ../Gender='M' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[../SupportCategory='PN' and ../Gender='F' and ../Tenure='P'])"/></td>
					<td><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[../SupportCategory='PN' and ../Gender='F' and ../Tenure='P'])"/></td>					
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td><b>Total</b></td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td><b>Cyfanswm</b></td></xsl:if>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[(contains($SupportCategory,concat(' ',../SupportCategory,' '))) and ../Gender='M' and ../Tenure='F'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[(contains($SupportCategory,concat(' ',../SupportCategory,' '))) and ../Gender='F' and ../Tenure='F'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[(contains($SupportCategory,concat(' ',../SupportCategory,' '))) and ../Gender='M' and ../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[(contains($SupportCategory,concat(' ',../SupportCategory,' '))) and ../Gender='M' and ../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/Headcount[(contains($SupportCategory,concat(' ',../SupportCategory,' '))) and ../Gender='F' and ../Tenure='P'])"/></b></td>
					<td><b><xsl:value-of select="sum(//SchoolSurvey/SupportStaff/CategoryDetails/PartTimeHours[(contains($SupportCategory,concat(' ',../SupportCategory,' '))) and ../Gender='F' and ../Tenure='P'])"/></b></td>
				</tr>
				</table>
				</P>
			
			<P CLASS="breakhere">
				
			<xsl:if test = "$lang='English'"><td><b><u>3.1 School milk</u></b></td></xsl:if>
			<xsl:if test = "$lang='Welsh'"><td><b><u>3.1 Llaeth ysgol</u></b></td></xsl:if>
			<br/><br/>
			<table>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of pupils eligible for free school milk </xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion sydd a hawl I gael llaeth am ddim </xsl:if>
					</td>
					<td> = <xsl:value-of select="count(//Pupils/Pupil[EligFreeMilk=1 or translate(normalize-space(EligFreeMilk),$vLower,$vUpper)='TRUE'])"/></td>
				</tr>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of pupils who had a free school milk on Census day </xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion yn cymryd llaeth am ddim ar ddiwrnod y cyfrif </xsl:if>
					</td>
					<td> = <xsl:value-of select="//SchoolSurvey/FreeMilk"/></td>
				</tr>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of pupils who bought school milk on Censusday </xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion yn prynu llaeth ar ddiwrnod y cyfrif </xsl:if>
					</td>
					<td> = <xsl:value-of select="//SchoolSurvey/PaidMilk"/></td>
				</tr>
			</table>
			<br/><br/>
			
			<xsl:if test = "$lang='English'"><td><b><u>3.2 School meals</u></b></td></xsl:if>
			<xsl:if test = "$lang='Welsh'"><td><b><u>3.2 Prydau ysgol</u></b></td></xsl:if>
			<br/><br/>
			<table>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of pupils eligible for free school meals </xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion ar y gofrestr sydd a hawl i gael prydau am ddim </xsl:if>
					</td>
					<td> = <xsl:value-of select="count(//Pupils/Pupil[FSMeligible=1 or translate(normalize-space(FSMeligible),$vLower,$vUpper)='TRUE'])"/></td>
				</tr>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of pupils who had a free school meal on Census day </xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion yn cymryd prydau canol dydd am ddim ar ddiwrnod y cyfrif </xsl:if>
					</td>
					<td> = <xsl:value-of select="//SchoolSurvey/FreeMeals"/></td>
				</tr>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of pupils who bought school meal on Censusday </xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion a dalodd am bryd canol dydd ar ddiwrnod y cyfrif </xsl:if>
					</td>
					<td> = <xsl:value-of select="//SchoolSurvey/PaidMeals"/></td>
				</tr>
			</table>
		</P> 
		
		<P CLASS="breakhere"> 
			<xsl:if test = "$lang='English'"><b><u>4.1 Pupils with statements of special educational needs</u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u>4.1 Disgyblion a Datganiad o Anghenion Addysgol Arbennig</u></b></xsl:if>				 
			<br/><br/>
			
			<table border="1" cellpadding="7"  cellspacing="0" width="70%">
				<xsl:if test = "$lang='English'">
					<tr>
						<th rowspan="3">Description of major need</th>
						<th colspan="4">Pupils with statements aged (ages as at 31.8.06)</th>
						<th rowspan="2" colspan="2" width="20%">Total number of pupils with statements</th>
					</tr>
					<tr>
						<th colspan="2">Under 5</th><th colspan="2">5 and over</th>
					</tr>
					<tr>
							<th>Boys</th><th>Girls</th>	<th>Boys</th><th>Girls</th><th>Boys</th><th>Girls</th>
							
					</tr>
				</xsl:if>
				<xsl:if test = "$lang='Welsh'">
					<tr>
						<th rowspan="3">Disgrifiad o'r prif angen</th>
						<th width="40%" colspan="4" >Disgyblion a datganiad (oed ar 31.8.06)</th>
						<th rowspan="2" colspan="2" width="20%">Cyfanswm nifer y disgyblion a datganiad</th>
					</tr>
					<tr>
						<th colspan="2" width="15%">O dan 5 oed</th><th colspan="2" width="15%">5 a throsodd</th>
					</tr>
					<tr>
							<th>Bechgyn</th><th>Merched</th><th>Bechgyn</th><th>Merched</th><th>Bechgyn</th><th>Merched</th>
					</tr>
				</xsl:if>
				<tr>
					<xsl:if test = "$lang='English'"><td>Moderate Learning Difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau dysgu cymedrol</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and  Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and  Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MLD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MLD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MLD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Severe Learning Difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau dysgu difrifol</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SLD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SLD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SLD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Profound and multiple learning difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau dysgu dwys a lluosog</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='PMLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='PMLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='PMLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='PMLD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='PMLD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='PMLD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Specific learning difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau dysgu penodol</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SPLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SPLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SPLD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SPLD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SPLD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SPLD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Autistic Spectrum Disorder</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Afiechyd sbectrwm Awtistiaeth</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='ASD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='ASD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='ASD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='ASD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='ASD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='ASD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Physical disabilities</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anableddau corfforol</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='PD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='PD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='PD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='PD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='PD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='PD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Hearing impairment</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Nam ar y cliw</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='HI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='HI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='HI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='HI' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='HI' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='HI' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Visual impairment</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Nam ar y golwg</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='VI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='VI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='VI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='VI' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='VI' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='VI' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Multi sensory impairment</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Nam amlsynhwyraidd</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MSI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MSI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MSI' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MSI' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MSI' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MSI' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Speech, language and communication difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau lleferydd, iaith  a chyfathrebu</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SLCD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SLCD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SLCD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SLCD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='SLCD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='SLCD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Emotional and behavioural difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau emosiynol ac ymddygiadol</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='EBD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='EBD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='EBD' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='EBD' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='EBD' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='EBD' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Medical difficulties</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Anawsterau meddygol</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MED' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MED' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MED' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MED' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='MED' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='MED' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td>Other</td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td>Arall</td></xsl:if>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='OTH' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='OTH' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='OTH' and SENtypeRank=1]] )" /></td>
					<td><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='OTH' and SENtypeRank=1]] )" /></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtype='OTH' and SENtypeRank=1]] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtype='OTH' and SENtypeRank=1]] )" /></b></td>
				</tr>
				<tr>
					<xsl:if test = "$lang='English'"><td><b>Total</b></td></xsl:if>
					<xsl:if test = "$lang='Welsh'"><td><b>Cyfanswm</b></td></xsl:if>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtypeRank=1 and SENtype != 'DNA']] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &lt; 5 and Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtypeRank=1 and SENtype != 'DNA']]  )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and  Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtypeRank=1 and SENtype != 'DNA']] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[(substring($AcademicYear, 1, 4) - substring(DOB, 1, 4 ) - (substring(DOB, 6, 2 ) > $Month)) &gt;= 5 and  Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtypeRank=1 and SENtype != 'DNA']] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='M' and SENstatus='S' and SENneeds/SENneed[SENtypeRank=1 and SENtype != 'DNA']] )" /></b></td>
					<td><b><xsl:value-of select="count(//Pupils/Pupil[Gender='F' and SENstatus='S' and SENneeds/SENneed[SENtypeRank=1 and SENtype != 'DNA']]  )" /></b></td>
				</tr>			
			</table>
		</P> 
		
		<P CLASS="breakhere">
			<xsl:if test = "$lang='English'"><b><u>4.2 Number of pupils with special needs but no statement</u></b></xsl:if>
			<xsl:if test = "$lang='Welsh'"><b><u>4.2 Disgyblion ac Anghenion Addysgol Arbennig</u></b></xsl:if>
			<br/><br/>
			<table>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Boys </xsl:if>
						<xsl:if test = "$lang='Welsh'">Bechgyn  </xsl:if>						
					</td>
					<td> : <xsl:value-of select="count(//Pupils/Pupil[Gender='M' and (SENstatus='A' or SENstatus='P' or SENstatus='Q') and SENneeds/SENneed/SENtype !='DNA'])"/></td>
				</tr>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Girls </xsl:if>
						<xsl:if test = "$lang='Welsh'">Merched  </xsl:if>						
					</td>
					<td> : <xsl:value-of select="count(//Pupils/Pupil[Gender='F' and (SENstatus='A' or SENstatus='P' or SENstatus='Q') and SENneeds/SENneed/SENtype !='DNA'])"/></td>
				</tr>
			</table>
			<br/><br/>
			
				<xsl:if test = "$lang='English'"><b><u>4.3 Special classes</u></b></xsl:if>
				<xsl:if test = "$lang='Welsh'"><b><u>4.3 Dosbarthiadau Arbennig</u></b></xsl:if>
				<br/><br/>
				<table>
					<tr>
						<td>
						<xsl:if test = "$lang='English'">Number of LEA designated special classes in the school</xsl:if>	
						<xsl:if test = "$lang='Welsh'">Nifer y dosbarthiadau arbennig yn eich ysgol a ddynodwyd gan yr AALI</xsl:if>
						<td> : <xsl:value-of select="//SchoolSurvey/LEASpecialClass"/></td>
						</td>
					</tr>
					<tr>
						<td>
						<xsl:if test = "$lang='English'">Number of pupils in such classes</xsl:if>	
						<xsl:if test = "$lang='Welsh'">Nifer y disgyblion yn y fath yma o ddosbarthiadau </xsl:if>
						<td>: <xsl:value-of select="//SchoolSurvey/PupilInLEASpecialClass + //SchoolSurvey/PupilOSLEASpecialClass"/></td>
						</td>
					</tr>
					<tr>
						<td>
						<xsl:if test = "$lang='English'">Are any of the pupils entered above on roll at another school</xsl:if>	
						<xsl:if test = "$lang='Welsh'">A yw unrhyw ddisgybl a nodir uchod wedi'I gofrestru mewn ysgol arall?</xsl:if></td>
						<td>
							<xsl:if test = "//SchoolSurvey/PupilOSLEASpecialClass &gt; 0"> : Y </xsl:if>
							<xsl:if test = "//SchoolSurvey/PupilOSLEASpecialClass &lt;= 0"> : N </xsl:if>

						</td>						
					</tr>
				</table>
				<br/><br/>	
			
			<br/><br/>
			
			<br/><br/>
			
			<table>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of unresolved validation errors</xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y camgymeriadau dilysu heb ateb</xsl:if>						
					</td>
					<td> = <xsl:value-of select = "substring-before($errors,'/')" /></td>
				</tr>		
				<tr></tr>
				<tr>
					<td>
						<xsl:if test = "$lang='English'">Number of validation queries</xsl:if>
						<xsl:if test = "$lang='Welsh'">Nifer y cwestiynau dilysu</xsl:if>						
					</td>
					<td> = <xsl:value-of select = "substring-after($errors,'/')" /></td>
				</tr>		
			</table>
			<br/><br/>
			<xsl:if test = "$lang='English'">
					This summary relates to the return dated <b><xsl:value-of select ="substring($dateTime,1,2)" />/<xsl:value-of select ="substring($dateTime,4,2)" />/
			<xsl:value-of select ="substring($dateTime,7,4)" /></b> at  <b><xsl:value-of select = "substring-after($dateTime,'#')" /></b><br/><br/><br/>
					DECLARATION<br/><br/>Signature .......................................................................<br/><br/><br/>
					Name  ............................................................................<br/><br/>
					Date  ...............................................................................
			</xsl:if>
			<xsl:if test = "$lang='Welsh'">
					Mae'r crynodeb hwn yn berthnasol i'r wybodaeth yr adroddwyd arni yn ddyddiedig <b><xsl:value-of select ="substring($dateTime,1,2)" />/<xsl:value-of select ="substring($dateTime,4,2)" />/
			<xsl:value-of select ="substring($dateTime,7,4)" /></b> am  <b><xsl:value-of select = "substring-after($dateTime,'#')" /></b><br/><br/><br/>
					DATGANIAD<br/><br/>Llofnod  .......................................................................<br/><br/><br/>
					Enw   ............................................................................<br/><br/>
					Dyddiad  ...............................................................................
			</xsl:if>		
		</P>	
		
	<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-899238-2";
urchinTracker();
</script>
</body>
	</html>
</xsl:template>

<xsl:template match="Message/SchoolSurvey/SpecialSchool/SpecialSchoolProvision/Provisions">
		<xsl:value-of select="Provision"/>
</xsl:template> 

<!--***										Global Variables											*** -->
	<xsl:variable name="rootelement" select="/Message"/>
	<xsl:variable name="AcademicYear" select="2006"/>
	<xsl:variable name="Month" select="08"/>
	<xsl:variable name="vLower"  select="'abcdefghijklmnopqrstuvwxyz'"/>
	<xsl:variable name="vUpper"  select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>
	<xsl:variable name="Sentype" select="' MLD SLD PMLD SPLD ASD PD HI VI MSI SLCD EBD OTH '"/>
	<xsl:variable name="TeacherCategory" select="' HT DH QT NQ PT PS '"/>
	<xsl:variable name="SupportCategory" select="' N1 N2 S1 S2 S3 PN '"/>
</xsl:stylesheet>


			