Difference between revisions of "GeoRSS-Simple to W3C Basic Geo XSLT"

From AwasuWiki
Jump to: navigation, search
Line 59: Line 59:
 
* [http://earthquake.usgs.gov/earthquakes/catalogs/1day-M2.5.xml USGS M2.5+ Earthquakes]
 
* [http://earthquake.usgs.gov/earthquakes/catalogs/1day-M2.5.xml USGS M2.5+ Earthquakes]
 
* [http://www.bing.com/maps/GeoCommunity.aspx?action=retrieverss&mkt=en-us&ss=&bbox=-123.09910900890827,37.93636400745027,-122.94015057384968,38.03418455724422&startindex=0&order=date Pt. Reyes, user-contributed places]
 
* [http://www.bing.com/maps/GeoCommunity.aspx?action=retrieverss&mkt=en-us&ss=&bbox=-123.09910900890827,37.93636400745027,-122.94015057384968,38.03418455724422&startindex=0&order=date Pt. Reyes, user-contributed places]
 +
 +
 +
For other ways to extend Awasu with GeoRSS support, click this link: [[GeoRSS]]

Revision as of 18:02, 1 December 2009

GeoRSS-Simple to W3C Basic Geo XSLT

This XSLT transformation converts GeoRSS <georss:point> elements found in your feeds into W3C Basic Geo <geo:lat> and <geo:long> elements where they will be further processed by Awasu's geo.mm Metadata module.

Note: "Converts" is a bit of a misnomer, as this XSLT transformation adds new <geo:lat> and <geo:long> elements to the feed and leaves the <georss:point> element unchanged.

Creating the XSLT file

  1. Copy the text in the box below and paste it into a new text file named georss-simple_to_w3c-basic-geo.xsl
  2. Save it in your \XSLT\ sub-directory under your Awasu installation directory.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
                              xmlns:georss="http://www.georss.org/georss"
                              xmlns:msxsl="urn:schemas-microsoft-com:xslt">
  <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<!--
"Default" template.
Matches everything and copies it to the output.
-->
  <xsl:template match="node()|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
      <xsl:apply-templates/>
    </xsl:copy>
  </xsl:template>

<!--
Matches the "georss:point" element and adds the <geo:lat /> and the <geo:long />
elements with the parsed latitude and longitude values.
-->
  <xsl:template match="georss:point">
    <xsl:copy>
      <xsl:apply-templates/>
    </xsl:copy>
      <xsl:element name="geo:lat">
        <xsl:value-of select="substring-before(., ' ')"></xsl:value-of>
      </xsl:element>
      <xsl:element name="geo:long">
        <xsl:value-of select="substring-after(., ' ')"></xsl:value-of>
      </xsl:element>
  </xsl:template>
</xsl:stylesheet>

To attach the XSLT file to a Channel

  1. Click the Processing button in the Details page of Awasu's Program Options dialog.
  2. Click the green plus sign + and the ... button to browse to the georss-simple_to_w3c-basic-geo.xsl file, select it.
  3. "Ok" your way out of Awasu's Program Options dialog... and you're done.

Any new feed items after you attach the georss-simple_to_w3c-basic-geo.xsl XSLT file to an Awasu Channel will now have the W3C Basic Geo elements <geo:lat> and <geo:long>.

Additional information about using XSLT files with Awasu can be found here: Feed Procesing

Here are a couple of sample feeds that contain GeoRSS-Simple elements:


For other ways to extend Awasu with GeoRSS support, click this link: GeoRSS