<?xml version='1.0' encoding='iso-8859-1'?>

<!-- An XSLT style sheet to transform a Plazes (http://www.plazes.com/) 
     "Traces" XML file  into an XML file suitable for use with 
     Google Maps hacking. -->

<!-- You can use TextXSLT to do the actual transformation, and you can get
 	 that at http://www.entropy.ch/software/macosx/ -->

<!-- Written by Peter Rukavina (http://www.ruk.ca/) 
	 (c) 2005 by Reinvented Inc.
	 License: http://creativecommons.org/licenses/by-sa/2.0/ca -->

<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
	<xsl:output method="xml" indent="yes" />
	<xsl:output omit-xml-declaration="no" />
	<xsl:template match="travels">
		<page>
			<title>Peter Rukavina's Plazes Traces</title>
			<query>Peter Rukavina's Plazes Traces</query>
			<center lat="46.237298" lng="-63.125682"/>
			<span lat="0.017335" lng="0.031972"/>
			<overlay panelStyle="panel.xsl">				
				<xsl:apply-templates select="location" />
			</overlay>
		</page>
	</xsl:template>
	<xsl:template match="location">
		<location infoStyle="info.xsl" id="A">
			<xsl:element name="point">
				<xsl:attribute name="lat">
					<xsl:variable name="lat" select="latitude"/>
					<xsl:variable name="latend" select="substring($lat, (string-length($lat) - 1) + 1)"/>
					<xsl:choose>
						<xsl:when test="$latend = 'N'">
							<xsl:value-of select="substring($lat, 1, (string-length($lat) - 1))"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="concat('-',substring($lat, 1, (string-length($lat) - 1)))"/>
						</xsl:otherwise>
					</xsl:choose>	        
			    </xsl:attribute> 
				<xsl:attribute name="lng">
					<xsl:variable name="lng" select="longitude"/>
					<xsl:variable name="lngend" select="substring($lng, (string-length($lng) - 1) + 1)"/>
					<xsl:choose>
						<xsl:when test="$lngend = 'E'">
							<xsl:value-of select="substring($lng, 1, (string-length($lng) - 1))"/>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="concat('-',substring($lng, 1, (string-length($lng) - 1)))"/>
						</xsl:otherwise>
					</xsl:choose>	        
			    </xsl:attribute> 
		    </xsl:element> 
			<icon image="http://maps.google.com/mapfiles/marker.png" class="local"/>
			<info>
				<title xml:space="preserve"><xsl:value-of select="name" /></title>
				<address><line><xsl:value-of select="city" />, <xsl:value-of select="country" /></line></address>
				<url><xsl:value-of select="url" /></url>
			</info>
		</location>
	</xsl:template>
</xsl:stylesheet>

