<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dyn="http://exslt.org/dynamic" xmlns:a="http://www.w3.org/2005/Atom" xmlns:georss="http://www.georss.org/georss" version="1.0" exclude-result-prefixes="dyn a georss">
	<xsl:output encoding="utf-8" indent="yes" method="xml"/>
	<xsl:template match="/">
<!-- namespace hack -->
		<xsl:value-of select="'&lt;kml xmlns=&quot;http://earth.google.com/kml/2.2&quot; &gt;'" disable-output-escaping="yes"/>
		<Document>
			<name>Preliminary Map of Sites Mentioned in "Greek, Roman and Byzantine Pottery at Ilion (Troia)". For the full text see http://classics.uc.edu/troy/grbpottery/ .</name>
			<Style id="ansicon">
<!-- using a Google maps icon for now -->
				<IconStyle>
					<Icon>
						<href>http://maps.google.com/mapfiles/kml/pal4/icon57.png</href>
					</Icon>
				</IconStyle>
			</Style>
			<xsl:apply-templates select="/a:feed/a:entry"/>
		</Document>
<!-- namespace hack -->
		<xsl:value-of select="'&lt;/kml&gt;'" disable-output-escaping="yes"/>
	</xsl:template>
	<xsl:template match="a:entry">
		<xsl:variable name="href" select="a:link[@rel='related']/@href"/>
		<Placemark>
			<name>
				<xsl:value-of select="a:title"/>
			</name>
			<description>
				<xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
				<div>
					<xsl:apply-templates select="dyn:evaluate(concat('document(&quot;groups.xml&quot;)/groups/group/link[@href =&quot;',$href,'&quot;]/..'))"></xsl:apply-templates>
				</div>
				<xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
			</description>
			<Point>
				<coordinates>
					<xsl:variable name="lat" select="substring-before(georss:point,' ')"/>
					<xsl:variable name="long" select="substring-after(georss:point,' ')"/>
					<xsl:value-of select="$long"/><xsl:value-of select="','"/><xsl:value-of select="$lat"/>
				</coordinates>
			</Point>
			<styleUrl>#ansicon</styleUrl>
		</Placemark>
	</xsl:template>
	<xsl:template match="group">
		<div><a href="http://classics.uc.edu/troy/grbpottery/html/{@id}.html"><xsl:value-of select="name"/></a></div>
	</xsl:template>
</xsl:stylesheet>
