Share via


Step 3: Create the Virtual Earth Map Location and Customize the XSL

Note

This topic describes functionality that is part of the Infrastructure Update for Microsoft Office Servers. To download the update, see Description of the SharePoint Server 2007 infrastructure update: July 15, 2008.

After you verify that the HTML to RSS federated connector is working (see Step 2: Add the Code for the Federated Search Virtual Earth Map Connector ), you need to create a federated location for it. You can then add a Federated Results Web Part that displays results from the location. The tasks involved include:

  • Creating the Federated location

  • Customizing the Federated location's XSL property

  • Adding the Federated Results Web Part

  • Testing the Federated Search Virtual Earth Map Connector

To create the federated location

  1. On the Search administration page of your Office SharePoint Server 2007 Shared Services Provider, click Federated Locations, and then click New Location.

  2. In the Location Name field and Display Name field, type the names you want to use for the location, and the text you want it to display as its name..

  3. In the Description field, type text to describe the location, such as Live Search Results.

  4. In the Version field, type 1.0.

  5. For the Location type field, click OpenSearch 1.0/1.1.

  6. In the Query Template field, type the URL for the RSS feed you created (for example, https://localhost/Default.aspx?q={searchTerms}).

  7. In the "More Results" Link Template field, type http:// search.live.com/results.aspx?q={searchTerms}.

  8. Click OK.

To customize the XSL property of the federated location

  1. On the Search Administration page, click Federated Locations.

  2. Under Location Display Name, click the name of your location.

  3. Expand the Display Information node.

  4. Under Federated Search Results Metadata, clear the Use Default Formatting check box.

  5. Click the ellipsis (…) button to open the Text Entry window for the location'sXSL property.

  6. Add this script under the <xsl:call-template name="MainTemplate.description"> section (directly under that section's </xsl:call-template> closing tag).

    <script type="text/javascript" language="javascript" >
    <xsl:text disable-output-escaping="yes">
    <![CDATA[
    <!--
    document.write('<script type="text/javascript" language="javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>');
    //-->
    ]]>
    </xsl:text>
    var map = null;
    // Set page event handlers for onload and unload
    if (window.attachEvent) {
    window.attachEvent("onload", Page_Load);
    window.attachEvent("onunload", Page_Unload);
    } else {
    window.addEventListener("DOMContentLoaded", Page_Load, false);
    window.addEventListener("unload", Page_Unload, false);
    }
    // Load map
    function Page_Load() {
    GetMap();
    }
    // Clean up all objects
    function Page_Unload() {
    if (map!=null) {
    map.Dispose();
    map = null;
    }
    }
    //Pass the latitude and longitude values from the RSS feed to Virtual Earth
    function GetMap()
    {
    map = new VEMap('FedMapDiv');
    map.SetDashboardSize(VEDashboardSize.Small);
    map.LoadMap(new VELatLong(<xsl:value-of select="latitude"/>,<xsl:value-of select="longitude"/>), 10, 'r', false);
    var mapdiv = document.getElementById("FedMapDiv");
    var yPos = mapdiv.clientHeight - 195;
    var location = new VELatLong(<xsl:value-of select="latitude"/>,<xsl:value-of select="longitude"/>);
    var shape = new VEShape(VEShapeType.Pushpin, location);
    map.AddShape(shape);
    map.SetCenterAndZoom(location, 12);
    }
    </script>
    <div id='FedMapDiv' style="position:relative; width:300px; height:300px;">
    </div>
    
  7. Click OK to close the Text Entry window.

  8. On the Edit Federated Location page, click OK to save the changes to the federated location.

To add the Federated Results Web Part to your Office SharePoint Server 2007 site

  1. From the Search Center, go to the search results page in the path http://YourServerName/results.aspx.

  2. Click Site Actions, and then click Edit Page.

  3. In the Right Zone, click Add a Web Part.

  4. In Suggested Parts for Right Zone, select Federated Results, and then click Add.

  5. Click Edit for the new Federated Results Web Part, and then click Modify Shared Web Part.

  6. In Location Properties, click the name of the location that you created from the Location list.

  7. In Display Properties, ensure that the Retrieve Results Asynchronously check box is cleared. The Web Part must load synchronously for the ECMAScript (JScript, JavaScript) in the XSL property to work correctly.

  8. Click OK.

  9. Click Exit Edit Mode to close the Edit page.

To test the HTML to RSS Federated Connector

  1. Go to the Search Center Home page in the path http://YourServerName/default.aspx.

  2. Type a valid address, consisting of street address, city, and state, in the search box.

  3. If the Federated Search Virtual Earth Map Connector is working, you should see an interactive Virtual Earth map on the search results page.

See Also

Concepts

Step 1: Set Up the Project for the Federated Search Virtual Earth Map Connector
Step 2: Add the Code for the Federated Search Virtual Earth Map Connector