How to: View the XML Data Returned by Your Federated Location

A federated location emits XML data, which is transformed into HTML by the XSLT specified in the federated location's XSL property (see Federated Results Web Parts XSLT [Search Server 2008]). This transformation occurs in the Federated Results Web Part. Altering the XSLT for a federated location gives you the ability to customize the data and appearance of your federated location. First, you must know the structure of the XML data that is emitted by your federated location.

If the location uses standard RSS or ATOM, the structure is predictable. (For more information, see RSS and ATOM.) However, if the federated location uses an arbitrary XML format or uses extensions to RSS or ATOM, you need to understand the data that is returned before you can modify the XSLT to transform the data.

You modify the XSLT code to display the raw XML data that is returned from a federated location. You can apply this code by editing the federated location's XSL property or the Federated Results Web Part at the site level.

You can use the XSLT to target pieces of the metadata. The match attribute of the xsl:template element enables the selection of pieces of the XML data to use in the transformation to HTML.

Note

The federated search Web Parts on the default results page are configured to use the Internet Search Results and the Internet Search Suggestions locations. The following XSLT code does not work as expected for the default configuration for these locations.

To modify the XSL property of a federated location

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

  2. Under Location Display Name, right-click the name of your location and click copy.

  3. On the Edit Federated Location page, name the federated location with a new name which indicates that the federated location is emitting only data (for example, "Raw XML").

  4. Expand the Display Information node.

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

    Note

    You can also use the Top Federated Results Web Part; however, only the Federated Results Web Part or the Top Federated Results Web Part is needed.

  6. Click the ellipsis (…) button to open the Text Entry window for the location's XSL property.

  7. Replace the default XSLT with the following.

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
        <xsl:template match="/">
            <xsl:copy-of select="*"/>
        </xsl:template>
    </xsl:stylesheet>
    
  8. Click OK to close the Text Entry window.

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

    The search results for this location now display as XML.

  10. Connect the new federated location to a Federated Results Web Part.

  11. Execute a query that returns results from the location, and be aware of the structure of the XML data that is returned.

Note

  If you update the federated location's XSL property, you must ensure that the Federated Results Web Part is configured to use the federated location's display information.

To configure the Federated Results Web Part to use the federated location's display information

  1. In your browser, navigate to the results page URL. For example, http:// ServerName/results.aspx.

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

  3. In the Federated Results Web Part instance you want to modify, click the edit arrow to display the Web Part menu, and then click Modify Shared Web Part.

  4. In the Federated Results Web Part tool pane, click the Display Properties arrow.

  5. Select Use Location Visualization.

  6. Click OK to update the Federated Results Web Part instance.

See Also

Other Resources

How to: View Search Results XML Data
How to: View and Edit the Search Results XSLT Transformation
How to: Change the Properties Returned in the Core Search Results
Customizing Search Results