Crash Course: Google Mini Development

Est. Reading Time: 4 minutes

I recently did some development for Winston-Salem State University‘s Google Search Appliance. Getting started was a bit tedious, requiring the analysis of 3600 lines of XSLT. This post aims to get you working where you need to quickly style and construct the page contents of the Google Mini.

After navigating to the Stylesheet Editor within the administration console of the Google mini, I recommend copying the contents over to a text editor such as Notepad++. The Google Mini will give you the line that errors occur on, however, there is no line count in the simple editor.

The Mini’s code has a few main stylesheets that we are going to focus on:

  • Global variables
  • Global styles
  • my_page_header
  • my_page_footer
  • swr_search
  • front_door
  • advanced_search
  • search_results

These can all be found by doing the following searches respectively (CTRL+F) in the document:

  • Logo setup (can be customized)
    • Note: Continues through ‘Global Style variables (can be customized)’ section
  • Result page components
    • Note: Continues down until line ~200 and XSL variables end.
  • <xsl:template name=”my_page_header”>
  • <xsl:template name=”my_page_footer”>
  • <xsl:template name=”swr_search”>
  • <xsl:template name=”front_door”>
  • <xsl:template name=”advanced_search”>
  • <xsl:template name=”search_results”>

The global styles and variables are worth a quick look, however most of the default settings are pretty suitable. Be sure not include semi-colons in the CSS values.

First, we want to look at swr_search, front_door, advanced_search, and search_results. In each of these templates, you want to add your content directly after:

	<xsl:call-template name="langHeadStart"/>
	   <title><xsl:value-of select="$swr_page_title"/></title>
	<xsl:call-template name="style"/>

You do not have to provide an opening or closing tag as the Mini appears to generate this with ” ” and ” in all four of these sections. Within your tag just below “landHeadEnd”, you should have the following:

       <xsl:call-template name="my_page_header"/>
       <xsl:call-template name="RESPECTIVE SECTION"/>
       <xsl:call-template name="my_page_footer"/>

Consider the following basic XHTML template:

       <div id="topnav"></div>
       <div id="wrap">
          <div id="leftnav"></div>
          <div id="content">
       <div id="footer"></div>

Now visit the “my_page_header” and “my_page_footer” sections. The above XHTML would go into “my_page_header”:

    <div id="topnav"></div>
       <div id="wrap">
          <div id="leftnav"></div>
          <div id="content">

And the rest into “my_page_footer”:

    <div id="footer"></div>

The calling sections that we first visited will populate the content area with your template constructed around it. If you need to modify the global styles further, although its is not recommended in the comments, you can search for “Global Style (do not customize)” and make additional modifications to the classes and Ids used by the default stylesheet. Additionally, if you want to remove the use of global styles altogether do a search for “” and comment it out in the respective sections you want it to no longer apply. Although its a hassle, I recommend copying and pasting back and forth between the Google Mini and your editor every few minutes and submitting the changes to debug for errors. The GSA will only give you a single error at a time, so if you there are multiple errors it requires multiple submissions and edits until you get it to validate–Much better just to test it as you go.