Umbraco - Google Maps - XSLT - Macro

The Following Macro allows you to insert a Google Map on any Umbraco Page:

1) Create a XSLT file and accopanying Macro called "GoogleMap.xslt":

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
  xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:CWS.Twitter="urn:CWS.Twitter"
  exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets CWS.Twitter ">

<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="width" select="/macro/width" />
<xsl:variable name="height" select="/macro/height" />
<xsl:variable name="googleMapsLink" select="/macro/googleMapsLink" />
<xsl:template match="/">
<iframe width="{$width}" height="{$height}" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="{$googleMapsLink}&amp;output=embed">&nbsp;</iframe>

2) Add the Following Paramaters to the Macro:

Alias: width
Name: width
Type: number

Alias: height
Name: height
Type: number

Alias: googleMapsLink
Name: googleMapsLink
Type: text

3) Enable the macro to 'Use in editor'

4) Insert the Macro on to your page.  You can get the googleMapsLink by clicking on the link Icon on any map in Google maps.


Popular posts from this blog

Umbraco Razor Sort Nodes Ascending or Descending

Umbraco Razor get Querystring

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco