diff options
author | Wojciech Polak <polak@gnu.org> | 2009-12-30 11:44:19 +0100 |
---|---|---|
committer | Wojciech Polak <polak@gnu.org> | 2009-12-30 11:44:19 +0100 |
commit | 9bdf9ddf5e577163c29c84d26cece95cc226afb5 (patch) | |
tree | 0b8a07a2f8894b528cee4018edf61bb67d58ad35 | |
parent | 306674c54066813ecf13fce0d93af736196e8ccb (diff) | |
download | fvx-9bdf9ddf5e577163c29c84d26cece95cc226afb5.tar.gz fvx-9bdf9ddf5e577163c29c84d26cece95cc226afb5.tar.bz2 |
Improve geo, add geo:Point.
-rw-r--r-- | fvx-html.xsl | 40 | ||||
-rw-r--r-- | fvx-json.xsl | 52 |
2 files changed, 60 insertions, 32 deletions
diff --git a/fvx-html.xsl b/fvx-html.xsl index 83529c5..dd06464 100644 --- a/fvx-html.xsl +++ b/fvx-html.xsl @@ -1,5 +1,5 @@ <!-- - FOAF.Vix fvx-html.xsl (2009-12-29) + FOAF.Vix fvx-html.xsl (2009-12-30) Copyright (C) 2006, 2008, 2009 Wojciech Polak This program is free software; you can redistribute it and/or modify it @@ -865,6 +865,23 @@ </xsl:call-template> </xsl:template> +<xsl:template match="geo:Point|geo:location"> + <xsl:choose> + <xsl:when test="rdf:Description/geo:lat"> + <xsl:call-template name="map-location"> + <xsl:with-param name="lat" select="rdf:Description/geo:lat"/> + <xsl:with-param name="long" select="rdf:Description/geo:long"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="geo:lat"> + <xsl:call-template name="map-location"> + <xsl:with-param name="lat" select="geo:lat"/> + <xsl:with-param name="long" select="geo:long"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> +</xsl:template> + <xsl:template name="map-location"> <xsl:param name="lat"/> <xsl:param name="long"/> @@ -1086,20 +1103,13 @@ <xsl:apply-templates select="contact:address | ../../contact:ContactLocation[@rdf:about = current()/@rdf:resource]"/> - <xsl:choose> - <xsl:when test="geo:location"> - <xsl:call-template name="map-location"> - <xsl:with-param name="lat" select="geo:location/geo:lat"/> - <xsl:with-param name="long" select="geo:location/geo:long"/> - </xsl:call-template> - </xsl:when> - <xsl:when test="geo:lat and geo:long"> - <xsl:call-template name="map-location"> - <xsl:with-param name="lat" select="geo:lat"/> - <xsl:with-param name="long" select="geo:long"/> - </xsl:call-template> - </xsl:when> - </xsl:choose> + <xsl:apply-templates select="geo:location|geo:Point|contact:address/geo:Point"/> + <xsl:if test="geo:lat and geo:long"> + <xsl:call-template name="map-location"> + <xsl:with-param name="lat" select="geo:lat"/> + <xsl:with-param name="long" select="geo:long"/> + </xsl:call-template> + </xsl:if> </td> </tr> </xsl:template> diff --git a/fvx-json.xsl b/fvx-json.xsl index 6133698..2a5e86d 100644 --- a/fvx-json.xsl +++ b/fvx-json.xsl @@ -1,5 +1,5 @@ <!-- - FOAF.Vix fvx-json.xsl (2009-12-29) + FOAF.Vix fvx-json.xsl (2009-12-30) Copyright (C) 2006, 2008, 2009 Wojciech Polak This program is free software; you can redistribute it and/or modify it @@ -646,6 +646,33 @@ </xsl:if> </xsl:template> +<xsl:template match="geo:Point|geo:location"> + <xsl:choose> + <xsl:when test="rdf:Description/geo:lat"> + <xsl:call-template name="map-location"> + <xsl:with-param name="lat" select="rdf:Description/geo:lat"/> + <xsl:with-param name="long" select="rdf:Description/geo:long"/> + </xsl:call-template> + </xsl:when> + <xsl:when test="geo:lat"> + <xsl:call-template name="map-location"> + <xsl:with-param name="lat" select="geo:lat"/> + <xsl:with-param name="long" select="geo:long"/> + </xsl:call-template> + </xsl:when> + </xsl:choose> +</xsl:template> + +<xsl:template name="map-location"> + <xsl:param name="lat"/> + <xsl:param name="long"/> + <xsl:text>,"lat":"</xsl:text> + <xsl:value-of select="$lat"/> + <xsl:text>","long":"</xsl:text> + <xsl:value-of select="$long"/> + <xsl:text>"</xsl:text> +</xsl:template> + <xsl:template match="foaf:pubkeyAddress"> <xsl:call-template name="simpleAnchor"> <xsl:with-param name="name" select="'pubkey'"/> @@ -841,22 +868,13 @@ <xsl:apply-templates select="contact:address | ../../contact:ContactLocation[@rdf:about = current()/@rdf:resource]"/> - <xsl:choose> - <xsl:when test="geo:location"> - <xsl:text>,"lat":"</xsl:text> - <xsl:value-of select="geo:location/geo:lat"/> - <xsl:text>","long":"</xsl:text> - <xsl:value-of select="geo:location/geo:long"/> - <xsl:text>"</xsl:text> - </xsl:when> - <xsl:when test="geo:lat and geo:long"> - <xsl:text>,"lat":"</xsl:text> - <xsl:value-of select="geo:lat"/> - <xsl:text>","long":"</xsl:text> - <xsl:value-of select="geo:long"/> - <xsl:text>"</xsl:text> - </xsl:when> - </xsl:choose> + <xsl:apply-templates select="geo:location|geo:Point|contact:address/geo:Point"/> + <xsl:if test="geo:lat and geo:long"> + <xsl:call-template name="map-location"> + <xsl:with-param name="lat" select="geo:lat"/> + <xsl:with-param name="long" select="geo:long"/> + </xsl:call-template> + </xsl:if> <xsl:text>},</xsl:text> </xsl:template> |