Google Search Appliance: Google OneBox for Enterprise Developer’s Guide 20
Editing customer-onebox.xsl to Call Your XSL File
Edit the
customer-onebox.xsl
file to point to the
projects.xsl
file as follows:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- edit the xsl:include to point to your stylesheet file -->
<xsl:include href="projects.xsl"/>
<!-- change the xsl:call-template to call your template’s name -->
<xsl:template name="holder" match="OBRES">
<div class="oneboxResults">
<table>
<xsl:call-template name="projects"/>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
This file calls your stylesheet for all OneBox results, whether or not the results come from the
projects
OneBox. In a search appliance, the
customer-onebox.xsl
file only passes results to your style sheet.
The
customer-onebox.xsl
cannot be used as a OneBox module because it contains a
match
statement.
Merging a OneBox Module Output with the
Search Results
To merge a OneBox module output with the search results:
1. Append the argument
--dumpOutput=1
to the command line when you invoke the simulator.
Invoke the simulator from the directory in which you unzipped the simulator zip file.
2. Each time your provider returns a valid result, the simulator creates a new XML file in the current
directory, named
name-Results-number.xml
, where
name
is the name of your OneBox module,
and
number
is a unique integer. The simulator merges the XML for you.
3. Insert your OneBox module’s results into the search output XML. Copy the contents of your
<OneBoxResults>
element into the
<OBRES>
element, replacing the
module_name
attribute with
your module name. Omit the
<OneBoxResults>
element itself.
For example, the
projects
output appears as follows for a query on
project 1
:
<OneBoxResults>
<provider>Corporate Project Database</provider>
<title>
<urlText>Lookup results for project 1</urlText>
<urlLink>http://www.mycompany.com/cgi-bin/projects?projectId=1</urlLink>
</title>
<IMAGE_SOURCE>http://www.mycompany.com/icons/favicon.ico</IMAGE_SOURCE>
<MODULE_RESULT>
<U>http://www.mycompany.com/cgi-bin/projects?projectId=1</U>
<Field name="ProjectName">NextGen</Field>
<Field name="ProjectStatus">Green</Field>
</MODULE_RESULT>
</OneBoxResults>
Kommentare zu diesen Handbüchern