GeoRSS-Simple to W3C Basic Geo XSLT
From AwasuWiki
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.
Note: You must have MSXML installed for XSL processing to work.
Creating the XSLT file
- Copy the text in the box below and paste it into a new text file named georss-simple_to_w3c-basic-geo.xsl
- 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
- Click the Processing button in the Details page of channel's Properties dialog.
- Click the green plus sign + and the ... button to browse to the georss-simple_to_w3c-basic-geo.xsl file, select it.
- "Ok" your way out of 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
