GoogleMap Template

Aug 28, 2010 at 7:23 PM

Usage:

 

<xsl:call-template name="GoogleMap">
	<xsl:with-param name="Address" select="@WorkAddress"></xsl:with-param>
	<xsl:with-param name="City" select="@WorkCity"></xsl:with-param>
	<xsl:with-param name="State" select="@WorkState"></xsl:with-param>
	<xsl:with-param name="ZipCode" select="@WorkZip"></xsl:with-param>
 	<!-- Optional Parameters -->
	<xsl:with-param name="Height" select="'600'"></xsl:with-param>
	<xsl:with-param name="Width" select="'800'"></xsl:with-param>
</xsl:call-template>

Template:

 

	<xsl:template name="GoogleMap">
		<xsl:param name="Address" />
		<xsl:param name="City" />
		<xsl:param name="State" />
		<xsl:param name="ZipCode" />
		<xsl:param name="paramHeight" />
		<xsl:param name="paramWidth" />
		<xsl:variable name="Height">
			<xsl:choose>
				<xsl:when test="string-length($paramHeight) &gt; 0">
					<xsl:value-of select="$paramHeight"/>
				</xsl:when>
				<xsl:otherwise>
					350
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="Width">
			<xsl:choose>
				<xsl:when test="string-length($paramWidth) &gt; 0">
					<xsl:value-of select="$paramWidth"/>
				</xsl:when>
				<xsl:otherwise>
					425
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<tr>
			<xsl:text disable-output-escaping="yes">&lt;iframe width=&quot;</xsl:text>
			<xsl:value-of select="$Width"/>
			<xsl:text disable-output-escaping="yes">&quot; height=&quot;</xsl:text>
			<xsl:value-of select="$Height"/>
			<xsl:text disable-output-escaping="yes">&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; src=&quot;http://www.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=</xsl:text>
			<xsl:value-of select="$Address"/>
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$City"/>
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$State"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$ZipCode" />
			<xsl:text disable-output-escaping="yes">&amp;&amp;ie=UTF8&amp;hq=&amp;hnear=</xsl:text>
			<xsl:value-of select="$Address" />
			<xsl:text  disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$City" />
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$State"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$ZipCode"/>
			<xsl:text disable-output-escaping="yes">&amp;z=14&amp;output=embed&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;small&gt;&lt;a href=&quot;http://www.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=</xsl:text>
			<xsl:value-of select="$Address" />
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$City" />
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$State"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$ZipCode" />
			<xsl:text disable-output-escaping="yes">&amp;&amp;ie=UTF8&amp;hq=&amp;hnear=</xsl:text>
			<xsl:value-of select="$Address" />
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$City" />
			<xsl:text disable-output-escaping="yes">,</xsl:text>
			<xsl:value-of select="$State"/>
			<xsl:text> </xsl:text>
			<xsl:value-of select="$ZipCode" />
			<xsl:text disable-output-escaping="yes">&amp;style=&quot;color:#0000FF;text-align:left&quot;&gt;View Larger Map&lt;/a&gt;&lt;/small&gt;</xsl:text>
		</tr>
	</xsl:template>

 

 

Coordinator
Sep 15, 2010 at 2:00 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.