<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:source = "http://www.leica-geosystems.com/LeicaXml/1.0">
	<xsl:template match="/">
		<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
		<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
		<html>
			<head>
				<style type = "text/css">
                  .AntCorr { font size : 65%;}
                  h1,.mhd{text-align:center;font-family:"Arial";font-size:18pt;font-style:normal;font-weight:bold;color:#000000;}
                  body,.body{text-align:left;font-family:"Arial";font-size:10pt;font-style:normal;font-weight:normal;color:#000000;}
                  th,.th{text-align:left;font-family:"Arial";font-size:10pt;font-style:normal;font-weight:bold;color:#000000;}
                  td,.td{text-align:left;font-family:"Arial";font-size:10pt;font-style:normal;font-weight:normal;color:#000000;}
                  h2,h3,.heading{text-align:left;font-family:"Arial";font-size:12pt;font-style:normal;font-weight:bold;color:#000000;background-color:#dfdfdf;}
                  FileCreated{text-align:center;font-family:"Arial";font-size:10pt;font-style:normal;font-weight:normal;color:#000000;}
                  span.satSystem:first-child:before {content: '';}
                  span.satSystem:before {content: ' + ';}
                </style>
			</head>
			<body>
				<br />
				<h1 align="center">
					<img>
						<xsl:attribute name="src">
							<xsl:value-of select="Leica_Geosystems_Spider/Xsl_Logo_Path"/>
							<xsl:value-of select="'Logo.gif'"/>
						</xsl:attribute>
					</img>
				</h1>
				<h5 align="center">
					<xsl:value-of select="Leica_Geosystems_Spider/SpiderVersion" />
					<xsl:text> - </xsl:text>
					<xsl:value-of select="Leica_Geosystems_Spider/NetworkName" />
				</h5>
				<br />
				<h1 align="center">Real Time Connection Log</h1>
				<br />
				<br />
				<br />
				<h2>General Information</h2>
				<table border="0" width="100%">
					<colgroup>
						<col width="20%" />
						<col width="40%" />
					</colgroup>
					<tr>
						<td>
							<xsl:choose>
								<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType = 'Single rover (NMEA Redirect)'">
									<xsl:text>Rover User Manager:</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>User-ID:</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
						<td>
                            <xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RoverUserName) &gt; 0">
                                    <xsl:choose>
                                        <xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RoverCredentialName) &gt; 0 and Leica_Geosystems_Spider/vwConnectionLog/RoverCredentialName != Leica_Geosystems_Spider/vwConnectionLog/RoverUserName">
                                            <xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RoverCredentialName" />
                                            (<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RoverUserName" />)
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RoverUserName" />                                        
                                        </xsl:otherwise>
                                    </xsl:choose>                                
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>[</xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/JobID" />
									<xsl:text>]</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Rover user name:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RoverUserDetail) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RoverUserDetail" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Subscription-Id:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/SubscriptionId) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/SubscriptionId" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Organization:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RoverUserCompany) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RoverUserCompany" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Heartbeat timeout:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/HeartbeatDisconnectTime) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/HeartbeatDisconnectTime" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Server time setting:</td>
						<td>
							<xsl:text>Local time (UTC </xsl:text>
							<xsl:choose>
								<xsl:when test = "number(Leica_Geosystems_Spider/DiffOfUTCLocalTime) &lt; 0">
									<xsl:text>-</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>+</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
							<xsl:value-of select="number(Leica_Geosystems_Spider/DiffOfUTCLocalTime) div 60" />
							<xsl:text>h)</xsl:text>
						</td>
					</tr>
					<tr>
						<td>Client host:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RoverUserClientHost) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RoverUserClientHost" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Rtk Server host:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RtkServer) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RtkServer" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Connection-Id:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/JobGUID) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/JobGUID" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Connection started at:</td>
						<td>
							<xsl:choose>
								<xsl:when test = "number(substring(Leica_Geosystems_Spider/vwConnectionLog/StartTimeConnection,1,4)) &gt; 2000">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/StartTimeConnection" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>
							<xsl:choose>
								<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
									<xsl:text>Start sending corrections at:</xsl:text>
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>Start output Rover Data:</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
						<td>
							<xsl:choose>
								<xsl:when test = "number(substring(Leica_Geosystems_Spider/vwConnectionLog/StartTimeSending,1,4)) &gt; 2000">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/StartTimeSending" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Connection ended at:</td>
						<td>
							<xsl:choose>
								<xsl:when test = "number(substring(Leica_Geosystems_Spider/vwConnectionLog/EndTimeConnection,1,4)) &gt; 2000">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/EndTimeConnection" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Duration of connection:</td>
						<td>
							<xsl:value-of select="Leica_Geosystems_Spider/PeriodOfConnection" />
							<xsl:text> [H:M:S]</xsl:text>
						</td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>First reference station used / distance to station:</td>
								<td>
									<xsl:choose>
                      <xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/FirstSiteName) &gt; 0">
                          <xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/FirstSiteName" />
                      </xsl:when>
                      <xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/FirstSiteCode) &gt; 0">
										    <xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/FirstSiteCode" />
									    </xsl:when>
									    <xsl:otherwise>
										    <xsl:text>-</xsl:text>
									    </xsl:otherwise>
									</xsl:choose>
									<xsl:text> - </xsl:text>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/FirstRefStatID) &gt;= 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/FirstRefStatID" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> / </xsl:text>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/FirstDistanceToStat) &gt;= 0">
											<xsl:variable name="varFirstDistance" select="number(Leica_Geosystems_Spider/vwConnectionLog/FirstDistanceToStat) div 1000"/>
											<xsl:value-of select="format-number($varFirstDistance, '0.000')" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> km</xsl:text>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Last reference station used / distance to station:</td>
								<td>
									<xsl:choose>
										<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/LastSiteName) &gt; 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/LastSiteName" />
										</xsl:when>
                    <xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/LastSiteCode) &gt; 0">
                        <xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/LastSiteCode" />
                    </xsl:when>
                    <xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> - </xsl:text>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/LastRefStatID) &gt;= 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/LastRefStatID" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> / </xsl:text>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/LastDistanceToStat) &gt;= 0">
											<xsl:variable name="varLastDistance" select="number(Leica_Geosystems_Spider/vwConnectionLog/LastDistanceToStat) div 1000"/>
											<xsl:value-of select="format-number($varLastDistance, '0.000')" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> km</xsl:text>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
				</table>
				<br />
				<h2>Real Time Product Settings</h2>
				<table border="0" width="100%">
					<colgroup>
						<col width="20%" />
						<col width="40%" />
					</colgroup>
					<tr>
						<td>Product name:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RTProductName) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RTProductName" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Type:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Site/Cell/Rover Name/Company:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/SiteName) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/SiteName" />
								</xsl:when>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/CellName) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/CellName" />
								</xsl:when>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/ObservedRoverUserName) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/ObservedRoverUserName" />
									<xsl:text>-</xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/ObservedRoverUserCompany" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Send real time message to:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/Connection) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/Connection" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Connection settings:</td>
						<td>
							<xsl:choose>
								<xsl:when test="translate(Leica_Geosystems_Spider/vwConnectionLog/Connection, $smallcase, $uppercase) = 'ACCESSROUTER'">
									<xsl:choose>
										<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RtkServer) &gt; 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RtkServer" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/HostName" />
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text>:</xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/PortNr" />
								</xsl:when>
								<xsl:when test="translate(Leica_Geosystems_Spider/vwConnectionLog/Connection, $smallcase, $uppercase) = 'TCP/IP'">
									<xsl:choose>
										<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RtkServer) &gt; 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RtkServer" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/HostName" />
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text>:</xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/PortNr" />
								</xsl:when>
								<xsl:when test="translate(Leica_Geosystems_Spider/vwConnectionLog/Connection, $smallcase, $uppercase) = 'NTRIP-CASTER'">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/HostName" />
									<xsl:text>:</xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/PortNr" />
									<xsl:text>, </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/NtripMntp" />
								</xsl:when>
								<xsl:when test="translate(Leica_Geosystems_Spider/vwConnectionLog/Connection, $smallcase, $uppercase) = 'NTRIP-CLIENT'">
									<xsl:choose>
										<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/RtkServer) &gt; 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/RtkServer" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/HostName" />
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text>:</xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/PortNr" />
									<xsl:text>, </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/NtripMntp" />
								</xsl:when>
								<xsl:when test="contains(Leica_Geosystems_Spider/vwConnectionLog/Connection,'COM') and string-length(Leica_Geosystems_Spider/vwConnectionLog/Connection) &lt; 6">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/Baudrate" />
									<xsl:text>, </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/Parity" />
									<xsl:text>, </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/Databits" />
									<xsl:text>, </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/StopBit" />
									<xsl:text>, </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/FlowControl" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<td>Authentication:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/Authentication) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/Authentication" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>

					<xsl:choose>
						<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
							<td>Maximum distance to provide corrections:</td>
							<td>
								<xsl:choose>
									<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/UseMaxDistProvCorr) &gt;= 4">
										<xsl:variable name="varMaxDistance" select="number(Leica_Geosystems_Spider/vwConnectionLog/MaxDistProvCorr) div 1000"/>
										<xsl:value-of select="format-number($varMaxDistance, '0.0')" />
									</xsl:when>
									<xsl:otherwise>
										<xsl:text>-</xsl:text>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:text> km</xsl:text>
							</td>
						</xsl:when>
					</xsl:choose>

					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Check for nearest site/cell:</td>
								<td>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/AutoSelectCellSite) &gt; 0">
											<xsl:text>On</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Fallback when network is not available:</td>
								<td>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/FallbackOnNWOff) &gt; 0">
											<xsl:text>Yes</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>

								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Fallback when rover-master distance is shorter:</td>
								<td>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/FallbackOnDist) &gt; 0">
											<xsl:variable name="varFBDistance" select="number(Leica_Geosystems_Spider/vwConnectionLog/FallbackDistance)"/>
											<xsl:value-of select="format-number($varFBDistance, '0.0')" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> m</xsl:text>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Fallforward enabled:</td>
								<td>
									<xsl:choose>
										<xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/Fallforward) &gt; 0">
											<xsl:text>Yes</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>

								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Re-check if rover moves more than:</td>
								<td>
									<xsl:choose>
										<xsl:when test="(number(Leica_Geosystems_Spider/vwConnectionLog/AutoSelectCellSite) &gt; 0) and (number(Leica_Geosystems_Spider/vwConnectionLog/DistanceForChanging) &gt; 0)">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/DistanceForChanging" />
											<xsl:text> m</xsl:text>
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<td>Message type:</td>
						<td>
							<xsl:choose>
								<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/MessageType) &gt; 0">
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/MessageType" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:text>-</xsl:text>
								</xsl:otherwise>
							</xsl:choose>
						</td>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/TransformationID) &gt; 0">

								<td>Target Coordinate System:</td>
								<td>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/TransformationName" />
									<xsl:text> ( ID </xsl:text>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/TransformationID" />
									<xsl:text> )</xsl:text>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/TransformationID) &gt; 0">

								<td> </td>
								<td>
									<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/TransformationDescr" />
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Satellite system:</td>
								<td>
                                    <xsl:choose>
                                        <!-- if SatSystem is a number, it reprecents the SatSystems as a bit field -->
                                        <xsl:when test="number(Leica_Geosystems_Spider/vwConnectionLog/SatSystem) &gt;= 0">
                                          
                                            <xsl:variable name="SatSys" select="Leica_Geosystems_Spider/vwConnectionLog/SatSystem" />
                                            <xsl:variable name="bitGPS" select="1"/> 
                                            <xsl:variable name="bitGLO" select="2"/>
                                            <xsl:variable name="bitGAL" select="8"/>
                                            <xsl:variable name="bitBDS" select="32"/>
                                            <xsl:variable name="bitQZSS" select="64"/>
                            
                                            <xsl:if test="( $SatSys mod ( $bitGPS * 2 ) ) - ( $SatSys mod ( $bitGPS ) ) &gt; 0">
                                                <span class="satSystem">GPS</span> 
                                            </xsl:if>
                                            <xsl:if test="( $SatSys mod ( $bitGLO * 2 ) ) - ( $SatSys mod ( $bitGLO ) ) &gt; 0">
                                                <span class="satSystem">GLO</span>
                                            </xsl:if>
                                            <xsl:if test="( $SatSys mod ( $bitGAL * 2 ) ) - ( $SatSys mod ( $bitGAL ) ) &gt; 0">
                                                <span class="satSystem">GAL</span>
                                            </xsl:if>
                                            <xsl:if test="( $SatSys mod ( $bitBDS * 2 ) ) - ( $SatSys mod ( $bitBDS ) )  &gt; 0">
                                                <span class="satSystem">BDS</span>
                                            </xsl:if>
                                            <xsl:if test="( $SatSys mod ( $bitQZSS * 2 ) ) - ( $SatSys mod ( $bitQZSS ) ) &gt; 0">
                                                <span class="satSystem">QZSS</span>
                                            </xsl:if>
                                        </xsl:when>
                                        <!-- keep this to stay compatible to 'old' versions, SatSystem is already the string with sat systems -->
                                        <xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/SatSystem) &gt; 0">
                                            <xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/SatSystem" />
                                        </xsl:when>                                        
                                        <xsl:otherwise>
                                            <xsl:text>-</xsl:text>
                                        </xsl:otherwise>
									</xsl:choose>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
					<tr>
						<xsl:choose>
							<xsl:when test="Leica_Geosystems_Spider/vwConnectionLog/CellsSitesType != 'Single rover (NMEA Redirect)'">
								<td>Send NULLANTENNA:</td>
								<td>
									<xsl:choose>
										<xsl:when test="string-length(Leica_Geosystems_Spider/vwConnectionLog/SendNullAntenna) &gt; 0">
											<xsl:value-of select="Leica_Geosystems_Spider/vwConnectionLog/SendNullAntenna" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:text>-</xsl:text>
										</xsl:otherwise>
									</xsl:choose>
								</td>
							</xsl:when>
						</xsl:choose>
					</tr>
				</table>
				<br />
				<h2>Connection History</h2>
				<xsl:variable name="varDegreeMultiplicator" select="57.2957795130823"/>
				<table border="1" frame="box" width="70%">
					<colgroup>
						<col width="10%" />
						<col width="30%" />
						<col width="33%" />
						<col width="27%" />
					</colgroup>
					<tr bgcolor="#dfdfdf">
						<th>Time</th>
						<th>Event</th>
						<th>Real time product state</th>
						<th>Rover user state</th>
					</tr>
					<xsl:for-each select="Leica_Geosystems_Spider/vwConnectionLog">
						<xsl:sort select="Time"/>
						<tr>
							<td>
								<xsl:value-of select="Time" />
							</td>
							<td>
								<xsl:value-of select="Event" />
							</td>
							<td>
								<xsl:if test="string-length(ActMessageType) &gt; 0">
									<xsl:value-of select="ActMessageType" />
								</xsl:if>
								<xsl:if test="number(Satellites) &gt;= 0">
									<xsl:text>; </xsl:text>
									<xsl:choose>
										<xsl:when test = "contains(ActMessageType, 'FKP')" >
											<xsl:text>FKP-corr: </xsl:text>
											<xsl:value-of select="UsedSatellitesFKP" />
											<xsl:text> SV (G/R/C: </xsl:text>
											<xsl:value-of select="UsedSatellitesFKPGps" />
											<xsl:text>/</xsl:text>
											<xsl:value-of select="UsedSatellitesFKPGlo" />
											<xsl:text>/</xsl:text>
                                            <xsl:value-of select="UsedSatellitesFKPBds" />
											<xsl:text>)</xsl:text>
											<xsl:text>; </xsl:text>
										</xsl:when >
									</xsl:choose>
									<xsl:choose>
										<xsl:when test = "contains(ActMessageType, 'i-MAX')" >
											<xsl:text>fixed: </xsl:text>
											<xsl:value-of select="FixedSatellites" />
										</xsl:when >
										<xsl:when test = "contains(ActMessageType, 'Virtual RS')" >
											<xsl:text>fixed: </xsl:text>
											<xsl:value-of select="FixedSatellites" />
										</xsl:when >
										<xsl:otherwise>
											<xsl:text>Master: </xsl:text>
											<xsl:value-of select="FixedSatellites" />
										</xsl:otherwise>
									</xsl:choose>
									<xsl:text> SV (G/R/E/C/J: </xsl:text>
									<xsl:value-of select="FixedSatellitesGPS" />
									<xsl:text>/</xsl:text>
									<xsl:value-of select="FixedSatellitesGLO" />
									<xsl:text>/</xsl:text>
                                    <xsl:value-of select="FixedSatellitesGAL" />
                                    <xsl:text>/</xsl:text>
                                    <xsl:value-of select="FixedSatellitesBDS" />
                                    <xsl:text>/</xsl:text>
                                    <xsl:value-of select="FixedSatellitesQZSS" />
                                    <xsl:text>)</xsl:text>
                                    <xsl:text>; </xsl:text>
								</xsl:if>
                                <xsl:choose>
                                  <xsl:when test="string-length(ActRefStationName) &gt; 0">
                                    <xsl:value-of select="ActRefStationName" />
                                  </xsl:when>
                                  <xsl:when test="string-length(ActRefStationCode) &gt; 0">
                                    <xsl:value-of select="ActRefStationCode" />
                                  </xsl:when>
                                </xsl:choose>
								<xsl:if test="number(ActRefStationID) &gt;= 0">
									<xsl:text> - </xsl:text>
									<xsl:value-of select='format-number(number(ActRefStationID), "0000")' />
								</xsl:if>
								<br />
                                <xsl:if test="string-length(Auxiliaries) &gt; 0">
                                    <xsl:value-of select="Auxiliaries" />
                                </xsl:if>
							</td>
							<td>
								<xsl:if test="string-length(ErrString) &gt; 0">
									<xsl:value-of select="ErrString" />
									<xsl:text>;</xsl:text>
									<br>
										<xsl:text>Rover position: </xsl:text>
									</br>
								</xsl:if>
								<xsl:choose>
									<!-- in pre 6.0 PositionFix was a text -->
									<xsl:when test="string(number(PositionFix)) = 'NaN'">
										<xsl:if test="string-length(PositionFix) &gt; 0">
											<xsl:value-of select="PositionFix" />
										</xsl:if>
									</xsl:when>
									<!-- in 6.0 and higher we have the numeric value -->
									<xsl:when test="PositionFix = '-1'">
									</xsl:when>
									<xsl:otherwise>
										<xsl:choose>
											<xsl:when test="PositionFix = 0">
												<xsl:text>Invalid (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:when>
											<xsl:when test="PositionFix = 1">
												<xsl:text>SPS (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:when>
											<xsl:when test="PositionFix = 2">
												<xsl:text>DGPS (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:when>
											<xsl:when test="PositionFix = 3">
												<xsl:text>PPS (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:when>
											<xsl:when test="PositionFix = 4">
												<xsl:text>RTK fixed (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:when>
											<xsl:when test="PositionFix = 5">
												<xsl:text>RTK float (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:when>
											<xsl:otherwise>
												<xsl:text>Invalid (</xsl:text>
												<xsl:value-of select="number(PositionFix)" />
												<xsl:text>)</xsl:text>
											</xsl:otherwise>
										</xsl:choose>
									</xsl:otherwise>
								</xsl:choose>
								<xsl:if test="number(SatellitesUsed) &gt;= 0">
									<xsl:text>; </xsl:text>
									<xsl:value-of select="SatellitesUsed" />
									<xsl:text> SV</xsl:text>
								</xsl:if>
								<xsl:if test="number(HDOP) &gt;= 0">
									<xsl:text>; </xsl:text>
									<xsl:text>HDOP </xsl:text>
									<xsl:value-of select="format-number(HDOP, '##0.0')" />
								</xsl:if>
								<xsl:if test="(string-length(Latitude) &gt; 0) and (string-length(Longitude) &gt; 0) and (string-length(Height) &gt; 0)">
									<xsl:if test="not((number(Latitude) = (-1)) and (number(Longitude) = (-1)) and (number(Height) = (-1)))">
										<xsl:choose>
											<xsl:when test="number(Latitude) &gt;= 0">
												<xsl:variable name="varLatDeg" select="number(Latitude) * $varDegreeMultiplicator"/>
												<xsl:variable name="varLatDegFormated" select="format-number(floor($varLatDeg), '##0')"/>
												<xsl:variable name="varLatMin" select="($varLatDeg - $varLatDegFormated)*60"/>
												<xsl:variable name="varLatMinFormated" select="format-number(floor($varLatMin), '##0')"/>
												<xsl:variable name="varLatSec" select="($varLatMin - $varLatMinFormated)*60"/>
												<xsl:variable name="varLatSecFormated" select="format-number($varLatSec, '##0.0000')"/>
												<xsl:text>; </xsl:text>
												<xsl:value-of select="$varLatDegFormated" />
												<xsl:text>&#176; </xsl:text>
												<xsl:value-of select="$varLatMinFormated" />
												<xsl:text>' </xsl:text>
												<xsl:value-of select="$varLatSecFormated" />
												<xsl:text>'' N</xsl:text>
											</xsl:when>
											<xsl:otherwise>
												<xsl:variable name="varLatDeg" select="number(Latitude) * $varDegreeMultiplicator * (-1)"/>
												<xsl:variable name="varLatDegFormated" select="format-number(floor($varLatDeg), '##0')"/>
												<xsl:variable name="varLatMin" select="($varLatDeg - $varLatDegFormated)*60"/>
												<xsl:variable name="varLatMinFormated" select="format-number(floor($varLatMin), '##0')"/>
												<xsl:variable name="varLatSec" select="($varLatMin - $varLatMinFormated)*60"/>
												<xsl:variable name="varLatSecFormated" select="format-number($varLatSec, '##0.0000')"/>
												<xsl:text>; </xsl:text>
												<xsl:value-of select="$varLatDegFormated" />
												<xsl:text>&#176; </xsl:text>
												<xsl:value-of select="$varLatMinFormated" />
												<xsl:text>' </xsl:text>
												<xsl:value-of select="$varLatSecFormated" />
												<xsl:text>'' S</xsl:text>
											</xsl:otherwise>
										</xsl:choose>								
										<xsl:choose>
											<xsl:when test="number(Longitude) &gt;= 0">
												<xsl:variable name="varLonDeg" select="number(Longitude) * $varDegreeMultiplicator"/>
												<xsl:variable name="varLonDegFormated" select="format-number(floor($varLonDeg), '##0')"/>
												<xsl:variable name="varLonMin" select="($varLonDeg - $varLonDegFormated)*60"/>
												<xsl:variable name="varLonMinFormated" select="format-number(floor($varLonMin), '##0')"/>
												<xsl:variable name="varLonSec" select="($varLonMin - $varLonMinFormated)*60"/>
												<xsl:variable name="varLonSecFormated" select="format-number($varLonSec, '##0.0000')"/>
												<xsl:text>; </xsl:text>
												<xsl:value-of select="$varLonDegFormated" />
												<xsl:text>&#176; </xsl:text>
												<xsl:value-of select="$varLonMinFormated" />
												<xsl:text>' </xsl:text>
												<xsl:value-of select="$varLonSecFormated" />
												<xsl:text>'' E</xsl:text>
											</xsl:when>
											<xsl:otherwise>
												<xsl:variable name="varLonDeg" select="number(Longitude) * $varDegreeMultiplicator * (-1)"/>
												<xsl:variable name="varLonDegFormated" select="format-number(floor($varLonDeg), '##0')"/>
												<xsl:variable name="varLonMin" select="($varLonDeg - $varLonDegFormated)*60"/>
												<xsl:variable name="varLonMinFormated" select="format-number(floor($varLonMin), '##0')"/>
												<xsl:variable name="varLonSec" select="($varLonMin - $varLonMinFormated)*60"/>
												<xsl:variable name="varLonSecFormated" select="format-number($varLonSec, '##0.0000')"/>
												<xsl:text>; </xsl:text>
												<xsl:value-of select="$varLonDegFormated" />
												<xsl:text>&#176; </xsl:text>
												<xsl:value-of select="$varLonMinFormated" />
												<xsl:text>' </xsl:text>
												<xsl:value-of select="$varLonSecFormated" />
												<xsl:text>'' W</xsl:text>
											</xsl:otherwise>
										</xsl:choose>								
										<xsl:text>; </xsl:text>
										<xsl:value-of select="format-number(Height, '##0.000')" />
										<xsl:text> m</xsl:text>
										<xsl:text>; </xsl:text>
									</xsl:if>
								</xsl:if>
								<xsl:if test="ActNMEARefStationID">
									<xsl:if test="PositionFix != '-1'">
										<xsl:value-of select='format-number(number(ActRefStationID), "0000")' />
										<xsl:text>; </xsl:text>
									</xsl:if>
									<xsl:choose>
										<xsl:when test="ActNMEARefStationID &lt; 4096">
											<xsl:choose>
												<xsl:when test="PositionFix != '-1'">
													<xsl:value-of select='format-number(number(ActNMEARefStationID), "0000")' />
												</xsl:when>
											</xsl:choose>
										</xsl:when>
										<xsl:when test="PositionFix = '-1' and ActNMEARefStationID &gt; 4095">
										</xsl:when>
										<xsl:otherwise>
											<xsl:choose>				  
												<xsl:when test="number(ActNMEARefStationID) = -1">
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5000">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (No Diff / Other Diff Type)</xsl:text>
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5001">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (JD Diff)</xsl:text>
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5002">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (WAAS or EGNOS)</xsl:text>
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5003">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (SF1 or SF2)</xsl:text>
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5004">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (RTK-X)</xsl:text>
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5005">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (RTK Fix)</xsl:text>
												</xsl:when>
												<xsl:when test="number(ActNMEARefStationID) = 5006">
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (NoNav)</xsl:text>
												</xsl:when>
												<xsl:otherwise>
													<xsl:value-of select="number(ActNMEARefStationID)" />
													<xsl:text> (Undefined)</xsl:text>
												</xsl:otherwise>
											</xsl:choose>				  
										</xsl:otherwise>
									</xsl:choose>
								</xsl:if>								
							</td>
						</tr>
					</xsl:for-each>
				</table>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
