<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
  <xsl:template match='/'>
    <HTML>
      <HEAD>
        <TITLE>test</TITLE>
		<STYLE TYPE="text/css">
		B		{ color: #63639C; font-family: arial }
		TD,TH		{ white-space: nowrap; empty-cells: show; padding: 1px 6px; border: inset 1px }
		TH		{ text-align: left; padding: 4px ; background-color: #9ACD32; }
		TABLE		{ border: outset 1px }
		.small		{ font-size: 10px }
		.head		{ background-color: #FFFFCC; }
		.tit		{ background-color: #FFFF88; }
		</STYLE>
		</HEAD>
      <BODY>
	<h1><xsl:value-of select="kml/Document/name" /></h1>
	<TABLE>
		<TR>
			<TH>Name</TH>
			<TH>Latitude</TH>
			<TH>Longitude</TH>
			<TH>LookAt-latitude</TH>
			<TH>LookAt-longitude</TH>
			<TH>LookAt-altitude</TH>
			<TH>LookAt-range</TH>
			<TH>LookAt-tilt</TH>
			<TH>LookAt-heading</TH>
		</TR>
		<xsl:for-each select="//Placemark">
			<TR>
				<TD><xsl:value-of select='name' /></TD>
				<TD>
					<xsl:if test='string(substring-after(substring-after(Point/coordinates,","),","))'>
						<xsl:value-of select='substring-before(substring-after(Point/coordinates,","),",")' />
					</xsl:if>
					<xsl:if test='not(string(substring-after(substring-after(Point/coordinates,","),",")))'>
						<xsl:value-of select='substring-after(Point/coordinates,",")' />
					</xsl:if>
				</TD>
				<TD><xsl:value-of select='substring-before(Point/coordinates,",")' /></TD>
				<TD><xsl:value-of select='LookAt/latitude' /></TD>
				<TD><xsl:value-of select='LookAt/longitude' /></TD>
				<TD><xsl:value-of select='LookAt/altitude' /></TD>
				<TD><xsl:value-of select='LookAt/range' /></TD>
				<TD><xsl:value-of select='LookAt/tilt' /></TD>
				<TD><xsl:value-of select='LookAt/heading' /></TD>
			</TR>
		</xsl:for-each>
	</TABLE>
    </BODY>
    </HTML>
  </xsl:template>
</xsl:stylesheet>


<!-- replace this line <kml xmlns="http://earth.google.com/kml/2.2"> in the kml file header -->
<!-- with this line  <?xml-stylesheet type='text/xsl' href='getpos_csv.xsl'?><kml>  -->
<!-- rename the .KML file to .XML and then open the file in a browser -->
