<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="html" encoding="iso-8859-1" indent="yes"/>
      
      <xsl:template match="/FindARide">
            <h3><xsl:value-of select="Header/DisplayTitle"/></h3>            
                      
	        <xsl:for-each select="Operators/Operator">
	        
        		<xsl:variable name='link'>
				   <xsl:value-of select="Url"/>			   
				</xsl:variable>
				<xsl:variable name='email'>
				   <xsl:value-of select="BookingsEmail"/>			   
				</xsl:variable>
					
	            <table style="border:1px solid #666;width:50%;"> 
	            	<tr>
	            		<td style="background-color:#CCC;font-weight:bold;"><xsl:value-of select="TradingName"/></td>
	            	</tr>
	            	<tr>
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Address:</span><br />
	            			<xsl:if test='string(AddressLine1)'>
	            				<xsl:value-of select="AddressLine1"/><br />
	            			</xsl:if>
	            			<xsl:if test='string(AddressLine2)'>
		            			<xsl:value-of select="AddressLine2"/><br />
		            		</xsl:if>
		            		<xsl:if test='string(AddressLine3)'>
		            			<xsl:value-of select="AddressLine3"/><br />
		            		</xsl:if>
		            		<xsl:if test='string(Town)'>
		            			<xsl:value-of select="Town"/><br />
		            		</xsl:if>
		            		<xsl:if test='string(County)'>
		            			<xsl:value-of select="County"/><br />
		            		</xsl:if>
		            		<xsl:if test='string(Postcode)'>
		            			<xsl:value-of select="Postcode"/><br />
		            		</xsl:if>
	            		</td>
	            	</tr>
	            	<tr>	            		
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Phone:</span><br />
	            			<xsl:value-of select="BookingsPhoneNumber"/>
	            		</td>
	            	</tr>
	            	<tr>	            		
	            		<td>
	            			<span style="color:#333;font-weight:bold;">E-mail:</span><br />
		            		<a href="mailto:{$email}"><xsl:value-of select="BookingsEmail"/></a>
		            	</td>
	            	</tr>
	            	<tr>
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Operating centre:</span><br />
	            			<xsl:choose>
								<xsl:when test='PublicAccess = "No"'>
									No public access
								</xsl:when>
								<xsl:otherwise>
									Public access allowed
								</xsl:otherwise>
							</xsl:choose>
							<br />
							<xsl:choose>
								<xsl:when test='PublicWaitingRoom = "No"'>
									No public waiting room
								</xsl:when>
								<xsl:otherwise>
									There is a public waiting room
								</xsl:otherwise>
							</xsl:choose>
							<br />
							<xsl:choose>
								<xsl:when test='WheelchairAccessible = "No"'>
									No wheelchair access
								</xsl:when>
								<xsl:otherwise>
									Wheelchar access provided
								</xsl:otherwise>
							</xsl:choose>
	            		</td>
	            	</tr>
	            	<tr>
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Payment options:</span><br />
	            			<xsl:if test='CreditDebitCard = "Yes"'>
		            			Credit/Debit cards<br />
		            		</xsl:if>
		            		<xsl:if test='ChequeBankersCard = "Yes"'>
		            			Cheque with bankers card<br />
		            		</xsl:if>
		            		<xsl:if test='AccountServicesAvailable = "Yes"'>
		            			Account services available<br />
		            		</xsl:if>
	            		</td>
	            	</tr>
	            	<tr>
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Operating hours:</span><br />
	              			<xsl:choose>
		            			<xsl:when test='HoursOfOperation24x7 = "Yes"'>
			            			24 hours x 7 days
			            		</xsl:when>
			            		<xsl:otherwise>
									<xsl:if test='HoursOfOperationMonThu = "Yes"'>
			            				Mon - Thu: <xsl:value-of select="StartTimeMonThu"/> - <xsl:value-of select="EndTimeMonThu"/><br />
			            			</xsl:if>
			            			<xsl:if test='HoursOfOperationFri = "Yes"'>
			            				Fri: <xsl:value-of select="StartTimeFri"/> - <xsl:value-of select="EndTimeFri"/><br />
			            			</xsl:if>
			            			<xsl:if test='HoursOfOperationSat = "Yes"'>
			            				Sat: <xsl:value-of select="StartTimeSat"/> - <xsl:value-of select="EndTimeSat"/><br />
			            			</xsl:if>
			            			<xsl:if test='HoursOfOperationSun = "Yes"'>
			            				Sun: <xsl:value-of select="StartTimeSun"/> - <xsl:value-of select="EndTimeSun"/><br />
			            			</xsl:if>
			            			<xsl:if test='HoursOfOperationPubHol = "Yes"'>
			            				Pub hol: <xsl:value-of select="StartTimePubHol"/> - <xsl:value-of select="EndTimePubHol"/><br />
			            			</xsl:if>
								</xsl:otherwise>
		            		</xsl:choose>
		            	</td>
	            	</tr>
	            	<tr>
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Operation type:</span><br />
	            			<xsl:value-of select="OperationType"/>
	            		</td>
	            	</tr>
	            	<tr>
	            		<td>
	            			<span style="color:#333;font-weight:bold;">Vehicles:</span><br />
	            			Number of vehicles: <xsl:value-of select="NumberOfVehicles"/><br />
	            			Number of vehicles with wheelchair access: <xsl:value-of select="NumberOfVehiclesWheelchair"/>
	            		</td>
	            	</tr>
	            	<tr>
	            		<td><a href="{$link}" target="_blank">View this record on the TfL website</a></td>
	            	</tr>
	            </table>
	            <br />
	        </xsl:for-each>
            
            
            <xsl:variable name='logo'>
				   <xsl:value-of select="Header/Attribution/Logo"/>
			</xsl:variable>
			<xsl:variable name='link'>
				   <xsl:value-of select="Header/Attribution/Url"/>
			</xsl:variable>
            <table>
            	<tr>
            		<td>
            			<a href="{$link}" target="_blank" style="text-decoration:none;">
            				<img src="{$logo}" style="border:none;" />
	            			<xsl:value-of select="Header/Attribution/Text"/>	            			
            			</a>
            		</td>
            	</tr>
            </table>
      </xsl:template>      
</xsl:stylesheet>
