Home | Index

SearchMonkey Guide

Step 4: Endpoint

The third step of creating a Web Page data service is to specify your web service transformation rules. Given a particular set of web service output, you can specify an XSLT stylesheet to extract the desired data and represent it as DataRSS. This step is the heart of your data service.

Figure 2.11. Endpoint Screen

Endpoint Screen

If you select Other, you must provide an appropriate stylesheet. For example, calling A simple stylesheet to transform the first, best match into DataRSS would be:

?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<adjunctcontainer>
<adjunct id="smid:{$smid}" version="1.0">
<item rel="dc:subject" typeof="foaf:Organization" resource="{//artist/url}">
    <meta property="dc:title"><xsl:value-of select="//artist/name"/></meta>
    <item rel="foaf:depiction">
        <item rel="foaf:thumbnail" resource="{//artist/image_small}" />
    </item>
</item>
</adjunct>
</adjunctcontainer>
</xsl:template>
</xsl:stylesheet>

Thus, if Jane Smith's home page appears in a search result, and if SearchMonkey is able to extract Jane's favorite band from the page, you could call Last.fm's web service and annotate the search result with related bands. "If Jane Smith likes Metallica, she might also like Megadeth..."

At the bottom of the screen is the Preview Pane, which displays the results of your data service for one of your test URLs.

Figure 2.12. Preview Pane: Endpoint Screen

Preview Pane: Endpoint Screen

If SearchMonkey's application works correctly, the Preview Pane displays an HTML bulleted list of name/value pairs representing the structure of the DataRSS for that web service call. <item> rel attributes and <meta> property attributes appear as regular text, while literal <meta> values and the values of resource attributes appear in bold. If there are any problems with the transformation code, the Preview Pane displays a bulleted list of warnings and errors.

The Preview Pane contains several controls for cycling through your test parameters and determining your data inputs and outputs: