2
Vote

GoogleMap Template

description

Need to validate and post.
 
From: http://spxslt.codeplex.com/Thread/View.aspx?ThreadId=225177&ANCHOR#Post486010
 
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) > 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) > 0">
                <xsl:value-of select="$paramWidth"/>
            </xsl:when>
            <xsl:otherwise>
                425
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    <tr>
        <xsl:text disable-output-escaping="yes"><iframe width="</xsl:text>
        <xsl:value-of select="$Width"/>
        <xsl:text disable-output-escaping="yes">" height="</xsl:text>
        <xsl:value-of select="$Height"/>
        <xsl:text disable-output-escaping="yes">" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="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"></iframe><br /><small><a href="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="color:#0000FF;text-align:left">View Larger Map</a></small></xsl:text>
    </tr>
</xsl:template>

comments