<xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:witw='http://nwalsh.com/xmlns/witw-is#'
  xmlns:foaf='http://xmlns.com/foaf/0.1/'>

<xsl:output method="xml" indent="yes"/>

<xsl:template match="witw:is">
<page>
 <title>WITW is <xsl:apply-templates select="witw:user/witw:name"/></title>
 <query/>
 <center>
 	<xsl:attribute name="lat">
 		<xsl:value-of select="witw:locations/witw:location[1]/@lat"/>
 	</xsl:attribute>
 	<xsl:attribute name="lng">
 		<xsl:value-of select="witw:locations/witw:location[1]/@long"/>
 	</xsl:attribute>
 </center>
 <span lat="0.466185" lng="0.379213"/>
<overlay panelStyle="">
	<xsl:apply-templates select="witw:locations/witw:location[1]"/>
	<xsl:apply-templates select="witw:landmarks/witw:landmark"/>
	<xsl:apply-templates select="witw:users/witw:nearby"/>
</overlay>

</page>
</xsl:template>

<xsl:template match="witw:location">
  <location id="{generate-id(.)}" infoStyle="http://stuff.rancidbacon.com/gmaps/minipage.xsl">
    <point lat="{@lat}" lng="{@long}"/>
    <icon class="local" image="http://www.google.com/mapfiles/dd-start.png"/>
    <info>
      <title xml:space="preserve"><xsl:value-of select="//witw:user/witw:name"/></title>
      <address/>
      <minipage>
      	<div>
          <h2><xsl:value-of select="//witw:user/witw:name"/></h2>
          <p>Last updated on <xsl:value-of select="@date"/></p>
          <p>Homepage: <a href="{//witw:user/witw:uri}">
          	<xsl:value-of select="//witw:user/witw:uri"/></a>
	  </p>
	  <p>FOAFNaut: <a href="http://blub.foafnaut.org/?sha1={//witw:user/foaf:mbox_sha1sum}">
	  	Explore</a>
	  </p>
      	</div>
      </minipage>
    </info>
  </location>
</xsl:template>

<xsl:template match="witw:landmark">
   <location id="{generate-id(.)}"  infoStyle="http://stuff.rancidbacon.com/gmaps/minipage.xsl">
    <point lat="{@lat}" lng="{@long}"/>
    <icon class="local" image="http://maps.google.com/mapfiles/marker.png"/>
    <info>
      <title xml:space="preserve"><xsl:value-of select="@name"/></title>
      <address/>
      <minipage>
        <div>
          <h2><xsl:value-of select="@name"/></h2>
          <p>Location added by <xsl:value-of select="@userid"/></p>
          <p><a href="{@uri}">More information...</a></p>
        </div>
      </minipage>
    </info>    
   </location>
</xsl:template>

<xsl:template match="witw:nearby">
   <location id="{generate-id(.)}" infoStyle="http://stuff.rancidbacon.com/gmaps/minipage.xsl">
   <point lat="{@lat}" lng="{@long}"/>   
   <icon class="local" image="http://www.google.com/mapfiles/dd-start.png"/>
   <info>
      <title xml:space="preserve"><xsl:value-of select="@name"/></title>
      <address/>
      <minipage>
         <div>
         <h2>User: <xsl:value-of select="@name"/></h2>
      		<p><a href="http://mygmaps.com/show/0.0.6/?url=http%3A%2F%2Fwww.w3.org%2F2000%2F06%2Fwebdata%2Fxslt%3Fxslfile%3Dhttp%253A%252F%252Fwww.ldodds.com%252Fprojects%252Fwitw%252Fwitw2gm.xsl%26xmlfile%3Dhttp%253A%252F%252Fnorman.walsh.name%252F2005%252F02%252Fwitw%252Fis%252F{@name}">
      			Re-orient on <xsl:value-of select="@name"/>
      			</a></p>
	 </div>      			
      </minipage>      
   </info>
   </location>
</xsl:template>

</xsl:stylesheet>  